But Espargaro inexplicably started waving to the crowd as he began the final lap, incorrectly believing the race had finished and he had secured second on the podium.
That ended a four-podium race streak for Espargaro, who slipped to fifth, and he sits 22 points behind leader Quartararo in the standings.
The Aprilia rider was quick to apologise for his mistake after the race as he explained he had misread the circuit's timing tower when keeping an eye on the lap count.
"I'm sorry. That's the only thing that I can say, sorry to my team. It's completely my fault," Espargaro told reporters.
"My people [with the pit board] were the first ones [out of the last corner], so I had no time to watch the lap. Some laps I had no time to look at the laps [remaining] and the gap with [Jorge] Martin.
"I was pushing to the limit so I just watched the gap with Martin, +0.6, then I watched the tower and I saw 'L1'. So I did one lap and then I didn't remember that here in Barcelona the last lap is 'zero' not 'one'. And I closed the gas on the straight.
"So I'm very sorry for my team because I didn't have the speed of Fabio to win. But if I want to beat him in the championship I cannot do these mistakes. Today, I lost nine points, so I'm very sorry."
Espargaro also believes he could have maintained pace with Quartararo but had been too worried about concerns surrounding his tyre management.
"Yesterday between Michelin and my team, everybody put a lot of worry into my [mind] by saying that I use a lot of tyres, that I had to be gentle on the first laps and I was too gentle sincerely," Espargaro said.
"Because at the end of the race, when I overtook Martin, I had enough tyre to put 41.5s and go away.
"I think Fabio was not faster than me, but he was smarter, was able to push at the beginning, and then it's impossible to recover two, two-and-a-half seconds to Fabio.
"I think I could have gone with him at the beginning. But anyway, it's too late."