Lewis Hamilton produced a masterful performance to win a wet, chaotic, crash-strewn Brazilian Grand Prix and take the title fight to the final race.

His ninth win of 2016 came in a race with several high-speed accidents, two stoppages and five safety cars.

The victory cut the lead of his Mercedes team-mate Nico Rosberg, who finished second, to 12 points.

Rosberg will secure the championship if he finishes third in Abu Dhabi on 27 November even if Hamilton wins.

Untouchable. Un-seeable as well. Hamilton led from start to finish in a race that took place in torrential conditions

Hamilton legendary, whether he is champion this year or not

As one of the most dramatic races for years unfolded, Hamilton was supreme at the front in treacherous conditions, lapping consistently faster than anyone.

After each restart, Hamilton cruised easily away from Rosberg - building at one stage an 18-second lead in 14 laps before another safety car cut his lead to nothing.

His victory is the 52nd of his career, making him the second most successful race winner of all time ahead of Alain Prost (51). Michael Schumacher is way ahead on 91.

"Not too bad, huh," said Hamilton. "I was generally just chilling up front. When it rains it's usually a good day for me. It was tricky for everyone. There were definitely opportunities for aquaplaning, which everyone did.

"No mistakes, no issues, no spins. It was kind of interesting to hear how many people were spinning, but I didn't have that problem.

"I have always wanted to win since I watched Ayrton [Senna] win here in 1991. It has taken me a long time to get here and it is a historic day for me. To stand on the podium in Brazil where Ayrton was so loved was really special."

Rosberg said: "Lewis just did a great job. It was very difficult conditions and I can live with second for sure."

The future's bright, the future's orange

Hamilton's closest rival for much of the race was Red Bull's Dutch driver Max Verstappen, who passed Rosberg around the outside of Turn Three on lap 32 on one of several restarts after a safety car period.

Wow: Verstappen survived spins, overtook both Ferraris and gained 10 places in the closing laps

Had Red Bull not gambled on fitting intermediate tyres to Verstappen's car on lap 43, the Dutchman would almost certainly have split the Mercedes drivers and left Rosberg needing a second place in Abu Dhabi.

However, Verstappen's decision backfired. As the rain intensified, it became clear during a subsequent safety car period caused when Felipe Massa crashed on the pit straight on lap 48 that he needed to switch back to the full wets.

That left Verstappen down in 13th place but he set about recovering lost ground with incredible skill and gusto and fought up to pass Force India's Sergio Perez to take third into the fast Mergulho corner with two laps to go.

It was without question the most outstanding drive of an already stellar career that started only last year.

And it also included an almost unbelievable moment when Verstappen had a half-spin on the straight but recovered the car and got going again without losing second place to Rosberg.

How to make an epic race

The race started under the safety car, and when it released the field after eight laps, Hamilton built a three-second lead in five laps before a crash by Sauber's Marcus Ericsson on the pit straight brought the safety car back out.

How wet was it? Grosjean crashed before the race even began

Six laps later there was a restart, only for Kimi Raikkonen's Ferrari to suffer a frightening-looking crash on the straight just after the start line, prompting race director Charlie Whiting to stop the race for the first time.

Thirty-five minutes later, the race started again under the safety car, only to be stopped again seven laps later when conditions were deemed too dangerous.

After another 25-minute delay, it was restarted, the safety car pulling in after three laps and there were 16 laps of racing before Massa's crash.

That led to another safety car period, this time for seven laps, before the race was restarted and ran to the end.

Perez held on for fourth, less than a second ahead of Ferrari's Sebastian Vettel, who survived a spin earlier in the race out of the last corner.

At the bottom of the top 10, Felipe Nasr scored a critical ninth place for Sauber. The result gives the Swiss team their first points of the season and moves them ahead of Manor into 10th in the championship.

If they hold on to that, it will be worth in the region of $16m in prize money to the team.

Guess the F1 drivers on the Interlagos graffiti wall (this video has no sound)

Massa's spontaneous, mid-race, guard of honour

Massa's crash prompted emotional scenes as he waved to the crowd, some holding signs saying "Obrigado, Massa" - thank you Massa.

The popular Brazilian is retiring from F1 at the end of the season and was in tears as he walked back to the Williams pit draped in the Brazilian flag, cheered on by the crowd and applauded by members of other teams, before being embraced by his wife, son Felipe Jr, and then his crew members.

Several members of other teams, including his old team Ferrari, then walked out of their garages to the edge of the pit boxes and applauded him as he walked down the pitlane back to his garage as the cars continued to race. An impromptu guard of honour proved just how much he is admired across the sport.

Home hero: Felipe Massa crashed out at his final home race, but received a standing ovation from the crowd and the teams as he walked back to the pits in tears

Former team Ferrari were among those to show their appreciation of Massa