Italian Andrea Iannone, who is making way for Lorenzo at Ducati and joining Suzuki in 2017, finished third to deny Yamaha's Valentino Rossi a final podium appearance of the season.
Lorenzo's victory was Yamaha's first since June, and his own third of the year, but Marquez made him sweat before he could start celebrating his 44th win.
The younger Spaniard, second on the grid with Lorenzo on pole, fell back to sixth at the start as Iannone and Rossi surged ahead but regained second with 10 laps to go and then steadily closed the gap.
News that makes sense
Your trusted source for staying up-to-date with the world around you. Get free daily news updates and analysis, straight to your inbox.
(Reporting by Alan Baldwin in Sao Paulo, editing by Clare Fallon)
