Reigning champion Casey Stoner looked like he had a fifth Losail victory in the bag for most of the distance, until Lorenzo attacked in the closing stages - fighting off Stoner's Honda team-mate Dani Pedrosa, before battling past Stoner to take a lead he would not lose.
Pedrosa then shuffled Stoner back to the final step of the podium.
Lorenzo had kept his Yamaha at the front at the start, as a typically lightning launch by Pedrosa saw the Spaniard shoot from seventh to second.
Stoner made it past Pedrosa on lap three after a string of unsuccessful attacks, and then squeezed through a narrowing gap on the pits straight to depose Lorenzo from the head of the order a lap later.
At first Stoner was able to pull away, inching into a two-second lead and then maintaining a slight cushion.
All looked to be under control for Stoner until his pace abruptly faded in the final laps as his tyres appeared to go off severely, allowing both Lorenzo and Pedrosa to close right in.
Before Lorenzo could attack Stoner, Pedrosa shot past the Yamaha for second - but he only held it briefly as Lorenzo quickly sliced back through in a tight move.
Lorenzo then pounced on Stoner with three laps to go, and although the Australian drafted back ahead when they next hit the pits straight, Lorenzo retaliated under braking for Turn 1, reclaimed the lead, and then pulled away.
Pedrosa took second from Stoner soon after and chased down Lorenzo, but could not quite catch the Yamaha. Lorenzo's win was his first Losail victory at MotoGP level, and came in his first race back after suffering a nasty hand injury in Australia last October.
Front row qualifier Cal Crutchlow tumbled down the order off the line, then spent 17 laps trying ever harder to overtake his Tech 3 Yamaha team-mate Andrea Dovizioso for fourth. By the time the Briton made it through, the top three were long gone.
Moto2 champion Stefan Bradl charged up to sixth for LCR Honda in the early laps, before being pushed back by Nicky Hayden (Ducati) and Alvaro Bautista (Gresini Honda), as they and Hector Barbera (Pramac Ducati) hunted him down in a spectacular pack.
Ducati's Valentino Rossi and Yamaha's Ben Spies both endured terrible races - rapidly losing pace and finding themselves at the tail of the prototype pack in 10th and 11th, which is where they would finish, with Spies only a few seconds clear of top CRT runner Colin Edwards (Forward Suter-BMW).