Ocon took the lead after a chaotic, wet opening lap and restart, at which leader Hamilton was the only driver not to dive into the pits for slicks.
Hamilton paid a price for that by coming in on the next lap in green conditions, dropping him down the order with Ocon grabbing an unlikely lead.
While Ocon successfully defended his first ever grand prix lead against Aston Martin’s Sebastian Vettel, Alpine’s real threat came from behind as Hamilton climbed up the order.
But the Mercedes driver’s comeback was stunted by Ocon’s teammate Alonso, who displayed a defensive masterclass to prevent Hamilton from taking fourth for 11 laps.
Alonso thus eliminated the world champion’s chances of eventually catching Ocon as he settled for third on the road, which later became second as Vettel was disqualified for a fuel infringement.
Ocon was quick to praise Alonso’s role in securing his maiden F1 win and Alpine also heaped praise on the 40-year-old Spaniard for his share in the Enstone team’s first win in its new guise.
“[Alonso was] incredible, absolutely incredible,” said Alpine’s sporting director Alan Permane.
“Honestly, he’s happy for us, he’s happy for Esteban but I know he’s frustrated because he wants to win.”
Permane acknowledged Alonso’ work holding Hamilton up was crucial as the Spaniard defended brilliantly, in particularly in the fast run up to Turns 4 and 5, until a lock-up in Turn 1 allowed Hamilton past.
“100%. Undoubtedly, crucial,” said Permane. “It was 11 laps I believe.
“If he’d have got past him on the first lap, like he got past Carlos [Sainz, ahead of Alonso in third] on the first time past I’m sure Lewis would have been there.
“I think what we would have done is then just drop back a bit, give Seb the DRS and use that to protect a little bit but I don’t know if we would have held him off.”
Alonso said he was aware of the race situation by looking at the big screens around the track and didn’t need Alpine telling him how crucial it was to delay Hamilton’s rise through the ranks.
“No, 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 biggest screens, I knew that Esteban and Vettel were fighting, and they were like two corners in front of us.
“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’s win.”