The nail-biting finish sent the Mugello crowd into raptures as the pace of Lorenzo's Yamaha ultimately proved too much for the Honda of Marquez - with only 0.019 seconds separating the Spanish duo.
Lorenzo started the race in a similar fashion - as his Yamaha had a brilliant start which saw the Spaniard shoot from fifth on the grid into first, passing home favourite Valentino Rossi to take the lead out of the first corner.
Rossi attempted to slip past Lorenzo down the straight several times in the early stages of the race, but some incredible braking from the Spaniard saw him hold off the threat of Rossi, who could not find a way to pass his Yamaha team-mate.
This battle out front allowed Marc Marquez to stay within striking distances of the Yamaha pair, with the trio only separated by half a second as Lorenzo continued to fight off Rossi's charge.
On lap eight, the partisan crowd fell silent as Valentino Rossi's bike - and chances of winning in front of his home crowd - went up in smoke, as technical issues forced Rossi to retire from the race.
Rossi's retirement opened the door for the Ducati duo of Andrea Iannone and Andrea Dovizioso to duke it out for the final podium position, with the Honda of Dani Pedrosa in hot pursuit behind them.
The Ducati's were neck and neck, trading positions constantly while Pedrosa closed in - but a mistake from Dovizioso on Lap 17 ended his chances of a podium finish and gave third place to Iannone.
With three laps remaining - Marquez made his first major move down the straight on Lorenzo, as he briefly took the lead, but couldn't make it stick as his Honda ran wide on the next corner.
However, Marquez continued to push his bike to the limit and again passed Lorenzo at the beginning of the final lap, but Lorenzo responded again.
Third time appeared to be the charm for Marquez, who finally passed the Yamaha of Lorenzo and with half a lap to go - it appeared as though Marquez had the race wrapped up.
But one minor mistake made the difference, as Marquez's front tyre lifted as he turned on to the final straight - which opened the window for Lorenzo to out-pace the young Spaniard and snatch victory in the dying moments.
This wasn't the only battle that went down to the wire, as Andrea Iannone crossed the line in third - only 0.168 seconds ahead of Honda's Dani Pedrosa.
Andrea Dovizioso finished the race in fifth, while Suzuki's Maverick Vinales finished sixth.
Bradley Smith (Yamaha), Danilo Petrucci (Ducati), Aleix Espargaro (Suzuki) and Michele Pirro (Ducati) rounded out the top ten.
Jack Miller did not finish the race after crashing out on opening lap.