BAKU, Azerbaijan — Canadian Lance Stroll wrote his name in Formula One's history books — and made countryman Jacques Villeneuve eat his words — all in the same race.

The 18-year-old Stroll came within metres of second place at the Azerbaijan Grand Prix on Sunday to become the youngest rookie to race to a podium finish on the F1 circuit.

Red Bull driver Daniel Ricciardo came out on top in a chaotic race, while Sebastian Vettel extended his championship lead over Lewis Hamilton. Ricciardo secured his fifth career win, while Mercedes driver Valtteri Bottas overtook Stroll's Williams just before the finish line to take second place.

It was an extraordinary performance from Stroll, the son of a billionaire, who faced heavy criticism earlier in the season.

"I'm just lost for words," said Stroll, from Montreal. "Just lost out to Valtteri in the end, but still extremely happy with the result. I can't describe how I feel, it's beyond amazing."

Stroll is the first Canadian to finish on an F1 podium since Villeneuve finished third at the German Grand Prix in 2001.

Ironically, it's Villeneuve who has been one of Stroll's highest profile critics. The retired driver told autoweek.com on June 13 that Stroll's freshman year "is one of the worst rookie performances in the history of Formula 1."

Vettel steered his Ferrari into fourth, just ahead of Hamilton's Mercedes.

"It was just a crazy race, with all the safety cars and the chaos," Ricciardo said. "On the cool-down lap, I was just giggling like a schoolboy."

After eight races, Vettel leads Hamilton by 14 points in the drivers' championship.

In a stop-start race, the safety car came out three times in quick succession before a red flag stopped the grand prix near the midway point because debris littered the track.

Shortly before that, Hamilton and Vettel were involved in an incident that threatens to sour their good relations.

While behind a safety car Hamilton, who was in the lead, appeared to slow his car right in front of Vettel, causing Vettel to drive into him. An irate Vettel then accelerated alongside Hamilton and appeared to deliberately swerve back into him.

Vettel was given a 10-second stop-go penalty, but Hamilton lost valuable time changing a loose headrest at the same time.

Hamilton was on Vettel's tail on the last lap, but could not overtake.

The fact Ricciardo won from 10th on the grid, and that Bottas clawed his way back from last following an early incident, summed up a bizarre race.

"I had to overtake everyone. It just shows you should never give up," Bottas said. "I really enjoyed it. It was a shame Daniel was too far away at the end but in the circumstances it was a good result."

The race started at 5 p.m. local time with track temperatures at 53 degrees Celsius (127 Fahrenheit).

Hamilton was on pole position for the 66th time in his career, with Bottas second on the grid followed by Kimi Raikkonen in third and Vettel fourth.

Hamilton got away cleanly, but Raikkonen clipped Bottas and bumped his own Ferrari into the wall, and Vettel surged past them into second place.

But Bottas had to pit on the second lap for a new front wing, dropping to last, while Raikkonen complained of damage to the rear of his car.

Up ahead, Hamilton asked over the radio where Bottas was, perhaps concerned his teammate would not be able to protect him from Vettel later in the race.

Force India's Sergio Perez jumped up to third, with Red Bull's Max Verstappen fourth ahead of Raikkonen.

Moments later, Verstappen had to retire — for the fourth time in six races — because of engine problems.

At about the same time, the safety car came out for the first time because Daniil Kvyat's Toro Rosso was stalled on the side of the track.

This prompted a flurry of activity as drivers switched tires, changing the race order somewhat.

The race was just about to start again when race control called for the safety car to stay out, because of debris from Raikkonen's car.

The slowness of the safety car was annoying Hamilton, who complained that he couldn't get enough temperature into his tires.

Then came that incident with Vettel.

"He brake-tested me!" an angry Vettel said over car radio, while Hamilton argued differently.

When the race finally did start again — on lap 20 — Vettel just about held off the Williams cars of Felipe Massa and Stroll.

Within moments, the safety car was out again for the third time after Sergio Perez and his Force India teammate Esteban Ocon collided.

Perez was seemingly forced out of the race as too was Raikkonen, whose right rear tire was completely shredded.

The 6-kilometre (3.7-mile) Baku street circuit, which glides through the city's medieval walls and passes the Caspian Sea, caused problems all weekend due to its long straights and tight, hard-braking corners.

With debris littering the track, it was deemed too dangerous to race and the red flag came out on lap 22 of 51.

With the cars parked in the pit lane, mechanics made minor repairs.

A sullen-looking Vettel chatted to Ferrari team principal Maurizio Arrivabene, while Hamilton slipped on his headphones as he listened to music with his sunglasses on.

After 23 minutes, the race re-started at 6:15 p.m. local time behind a safety car — and Raikkonen and Perez were back, albeit at the back of the grid.

Vettel just failed to overtake Hamilton while Ricciardo brilliantly overtook Stroll to move into fourth.

Moments later, Massa retired, as did Renault's Nico Hulkenberg after clipping the barriers.

Then, the race order changed again as Vettel came in for his time penalty moments after Hamilton changed his headrest.

When Hamilton came back out again, he found himself behind Vettel and several others.

Ocon finished a credible sixth while Fernando Alonso placed ninth to secure McLaren's first points of a frustrating season.