SINGAPORE — Two safety cars and a virtual safety car period, a fan on the track, three or four cars losing power mysteriously and some great, fast racing through the streets of Singapore, it was all a lot more than had been imagined for race day on Sunday, even at the season’s longest, most grueling event.

But even after Saturday’s qualifying session for the Singapore Grand Prix, it became certain that the race would be an interesting one, no matter what happened on a track where overtaking and wheel-to-wheel racing is often absent.

The leading, dominant Mercedes cars were sitting back in fifth and sixth position on the starting grid after they had been outpaced all weekend, and outraced during qualifying.

It was the first time since 2013 that neither of the cars was on the first or second row of the grid, and this alone guaranteed that spectators would see a story unfold between the four drivers of the two teams ahead of the Mercedes: Ferrari and Red Bull.

In the end, it was Sebastian Vettel of Ferrari, who started on pole position who led from the start to finish, driving the 61 laps of the race through the chaos to take his third victory of the season and his fourth in Singapore.

It was also the 42nd victory of his career, which moved him into third place in the victory statistics, one spot above Ayrton Senna, with only Alain Prost with 51 and Michael Schumacher with 91 ahead of him.

“It was pretty intense,” Vettel said. “Obviously we had a bit of a breather with the safety car, but lots of pressure from behind. Then, on the second stint I was dictating the pace. It’s not easy to overtake here, so I was taking advantage of that.”

The action really began on the 13th lap when Felipe Massa, in a Williams, came out of the pits and Nico Hulkenberg, of the Force India team, collided with him as the two headed into the first corner side by side. Hulkenberg was out of the race.

That led to the use of the virtual safety car and then the real safety car and led to the first pit stops by the leaders. It took so long for the marshals to clear the debris on the track, that the real safety car was then called in.

The safety car period lasted for six laps as the race got underway again on Lap 19.

Then, on Lap 26 the series leader, Lewis Hamilton in a Mercedes, who was in fourth, had a problem on his car and lost time. His teammate, Nico Rosberg, passed him, and the British driver radioed in to his team to ask what the problem was and they sent instructions to change a setting. He dropped down to seventh.

“The throttle is not going to wide open throttle; is it the pedal?” asked his engineer. Hamilton responded that he was pressing it full. It was the final blow to a catastrophic weekend for Mercedes.

At that same moment, Vettel set the fastest lap of the race.

Mercedes continued to give instructions to Hamilton, and he said they were not working. Hamilton dropped down the pack bit by bit, and finally, on Lap 33, he dropped out of the race.

“I was superoptimistic in the car, the guys in front were on the options and I was on the primes,” Hamilton said. “And I said, ‘You know what, we have a race on our hands here,’ and I was waiting for the time that I could push. But it never came.”

The results meant, that with six races still to run in the season, Vettel stands in third in the series, 49 points — or two victories — behind Hamilton, while Rosberg, who finished fourth in the race, remains in second, and is 41 points behind Hamilton.

“All we have to do is look after ourselves, maximum attack,” Vettel said, before adding of his championship hopes: “We still have a small chance.”

His teammate, Kimi Raikkonen, finished third for Ferrari, while Daniel Ricciardo, driving a Red Bull, finished in second, just 1.4 seconds behind Vettel.

It had been a tight race from start to finish, and one that not only saw four cars drop out with technical problems but also had a sudden surprise of a fan deciding to watch the race from the track itself.

Suddenly, on Lap 37 Vettel cried out to his team over the radio: “There is a fan on the track!”

The safety car was deployed again to suspend the race so the man was not injured. He left the track of his own volition, but it changed the race, as most of the cars made another pit stop.

“Thanks to the guy on the track,” said Ricciardo sarcastically afterward as he felt it came at a bad moment for him and might have cost a victory.

Vettel, however, said afterward, “I had to look again because I wasn’t sure if I had a problem with my eyesight.

“He might have been there to take a picture,” the driver said. “I hope it was a good one!”

It did not appear to change the order of the race.

Through it all, Vettel held onto his position and took the victory, giving Ferrari and the German driver, hope for the rest of the season.

There was also another driver to keep an eye on, and that was not one who started at the front of the pack, but rather the man who qualified in last position for his first ever Formula One race. That was Alexander Rossi, the first American to race in Formula One since Scott Speed in 2007.

That Rossi started in last position was no dishonor, as he did so in the slowest team on the grid. He was, in essence, racing only his teammate, Will Stevens, of Britain. Rossi had a crash during his first time in the car on Friday’s practice session, but he managed to finish in second last position, ahead of his teammate.

A version of this article appears in print on , on Page D2 of the New York edition with the headline: Sports Briefing | Auto Racing; Vettel Dominates in Singapore Despite Track Distractions. Order Reprints | Today’s Paper | Subscribe