The two-time world champion turned in a defensive masterclass as he kept a charging Hamilton at bay for 10 laps as the duo scrapped over fourth place in the closing stages of Sunday’s race at the Hungaroring.

A lock-up for Alonso allowed the recovering Hamilton to finally get past with five laps remaining but the Spaniard’s stubborn defence helped Alpine teammate Esteban Ocon secure a shock maiden victory.

Hamilton complained that Alonso’s defending was “dangerous” but the 40-year-old reckoned he helped the seven-time world champion learn a better racing line that he later used to overtake Ferrari’s Carlos Sainz.

“I thought honestly that I could not hold him more than one or two laps,” Alonso said.

“But on the last couple of corners, he seemed to struggle a little bit to follow me. Then it was enough to open a gap on the straight and defend.

“I think he learned a couple of different lines in the last three corners after the 10 laps behind me.

“He was able to pass Carlos just in one lap, applying those new lines.”

Alonso said was not told by Alpine to hold Hamilton up in order to aid Ocon’s victory bid.

“The team didn’t tell me anything but I knew more or less what the situation of the race was,” he explained.

“I was looking at the big screens and I knew that Esteban and Vettel were fighting, they were like two corners in front of us.

“And with 20 laps to the end and Lewis coming two or three seconds faster, that was enough to win the race probably. So I knew that every lap I could hold him behind that was gold for Esteban to win.”

Alonso was convinced he had the “pace to win” but was ultimately happy to record his best result since making his F1 comeback at the start of the year.

“I was lucky not to finish the race in Turn 1, like some other people did,” Alonso said, “So we take this top five, it’s best result of the year.

“It was not a gift because I had to fight every single lap for every single position and I’m proud of my race, and driver of the day provably shows that.

“Hopefully in one race I will be on the lucky part and can get some podiums. Last year, we had three podiums, this year we had one podium.

“All of those need to come with some special races because by pure pace we cannot achieve it.”

He added: “I was so convinced about the podium. I was catching Carlos and Hamilton quite quickly, I was setting the fastest laps of the race, and I thought I will overtake them, and I will try to win the race. That was my mind in that moment.

“Then I started realising that maybe winning the race was not possible. It was not enough based on the strength, especially when the straight line speed was lacking to pass Carlos.

“I started thinking at that time that if I was right behind Carlos with the DRS, I could protect myself from Hamilton, and just finish fourth.”