MONTREAL — Mercedes driver Lewis Hamilton claimed a contentious victory at the Canadian Grand Prix on Sunday afternoon despite crossing the finish line second behind Ferrari's Sebastian Vettel.

Vettel was given a five-second penalty during the race and finished in second place.

Hamilton finished 1.342 seconds behind Vettel but the Italian's penalty for "unsafe re-entry" handed Mercedes its seventh straight victory of the season.

Ferrari's Charles Leclerc of Monaco came in third ahead of Mercedes' Valtteri Bottas of Finland.

Canadian Lance Stroll finished ninth for the third time this season after starting the race in 17th place.

Vettel started from pole position and was still in the lead when his race took a turn for the worse in the 48th lap.

The German made a mistake on turn four when he lost control of his car and drove onto the grass. When he returned to the track, he blocked Hamilton from passing and the British driver was forced to slam on the brakes.

The stewards reviewed the incident and imposed a five-second penalty on Vettel for "unsafe re-entry and forcing another driver off the track."

Vettel was irate when his team broke the news over the radio.

"I had nowhere to go. I didn't see him," said Vettel, who won the Canadian Grand Prix last year. "Where the hell was I supposed to go? They are stealing the race from us."

Vettel started from pole position and led the race for 64-of-70 laps. Hamilton was all over him but could not get the breakthrough prior to the incident.

When Vettel found out about the penalty, he tried to put together a five-second lead in order to claim victory but could not get the right pace.

The victory would have been Ferrari's first since last year's United States Grand Prix (Oct. 2018) and Vettel's first since last year's Belgian Grand Prix (Aug. 2018).

Instead, Mercedes has increased its lead atop the constructors' standings.

"That's not the way I wanted to win," said Hamilton over the team radio after crossing the finish line.

Stroll put together one of his best races of his young Formula One career. The 20-year-old earned two points — his fifth and sixth of the season — after starting fourth from the back.

The hometown driver gained three spots after an incredible start to the race and kept overtaking drivers throughout. He also finished in ninth place in Australia and Azerbaijan this year.

The race was redemption for Stroll, who had a difficult weekend. The Montreal native failed to make it past the first round of qualifying on Saturday afternoon, just a few hours after he was forced to retire from a practice session when the back of his car erupted in flames due to a hydraulic fluid leak.