Ferrari's Sebastian Vettel won an incident-packed Singapore Formula One Grand Prix after world champion Lewis Hamilton retired early for the first time this season and an intruder strolled onto the track.
Starting from pole position, Vettel led all the way to take the chequered flag for the fourth time at the floodlit Marina Bay Street Circuit, despite twice losing the big advantage he had built up when the safety car was deployed.
"It must be one of my best races. It was pretty intense," Vettel said. "If we have more weekends like this, yes we can catch Mercedes.
"Maybe we can make the impossible possible - we will definitely go for it."
Australia's Daniel Ricciardo finished second for Red Bull, his best result of a frustrating year, while Vettel's team-mate Kimi Raikkonen crossed the line third.
Hamilton was running fourth approaching the halfway point of the 61-lap race when he lost engine power, rapidly dropping back through the field before he was told to return to the garage and call it a night.
"I was feeling super-optimistic in the car, I really was," Hamilton said. "I was just waiting for that time when I could push and see what I could get from the car but obviously I didn't get that."
Nico Rosberg finished fourth for Mercedes to cut Hamilton's championship lead to 41 points. Vettel trails Hamilton by 49 and Raikkonen is 145 adrift with a maximum of 150 points available from the remaining six races. No other driver has a chance of winning the championship.
Vettel's win was the German's third this season and the 42nd of his career, enabling the quadruple world champion to overtake the late Ayrton Senna into outright third place for the most lifetime wins, trailing only Michael Schumacher (91) and Alain Prost (51).
A proven master on the slow and twisty Singapore track, Vettel gave his rivals no chance when he planted his foot on the accelerator and made a flying getaway from the front of the grid.
The 28-year-old opened up a commanding three-second lead over Ricciardo on the opening lap and was never seriously challenged even when the safety car was introduced.
Its first appearance came on the 13th lap when Felipe Massa exited the pits and was hit from the side by Nico Hulkenberg who slammed into a wall, wrecking his Force India car and ending his race. He was later given a three-spot grid penalty for the next race in Japan.
The second came on lap 37 when a spectator was spotted walking on the circuit before climbing back though a hole in the fence, setting pulses racing.
Vettel screamed to his team-mates on the radio when he saw the man and race stewards instantly unfurled their yellow flags, ordering the drivers to slow down.
Formula One officials later released a statement saying Singapore police had arrested a 27-year-old man who was helping them with their investigations.
Vettel described the intruder as "crazy" while Ricciardo, who was starting to inch closer to the front, said the introduction of the safety car cost him any chance of winning.
"Thanks to the guy on the track... appreciate it!" Vettel joked. "I was tempted to swerve - clip him!"
Hamilton, who needs one more win to draw level with his childhood hero Senna, endured his worst weekend of the season.
Valtteri Bottas finished fifth, Daniil Kvyat sixth, Sergio Perez seventh and Dutch teenager Max Verstappen was eighth after an eventful day.
The 17-year-old fell a lap behind when he stalled his Toro Rosso on the grid then defied team orders to let his team mate Carlos Sainz pass him at the end.
"If you are one lap down and you manage to be back in the points as the leading Toro Rosso, for me there was no reason to switch positions," he explained.