BARCELONA, Spain--Fernando Alonso won the Spanish Grand Prix in front of his jubilant home fans on Sunday to close the gap on championship leader Sebastian Vettel and get right back in the Formula One title race.

Finnish driver Kimi Raikkonen finished second for the third straight race, with Alonso's Ferrari teammate Felipe Massa in third spot as most drivers chose a four-stop strategy due to ongoing problem with Pirelli's fast-degrading tires. That issue remains a big concern as tires still shred far too easily despite pre-race modifications.

Staring from fifth place, Alonso won his second race this season, showing that Ferrari can challenge Red Bull for pure speed. Alonso was easily quicker than Vettel, with the three-time defending champion finishing fourth ahead of teammate Mark Webber.

"In the four years with Ferrari this is the best (car) we've had," Alonso said. "I realized the race was in our pockets if we don't do mistakes."

He climbed on top of his Ferrari and waved a Spanish flag gleefully as he milked the applause from the fans, who broke out into chants of "Alonso, Alonso."

It was Alonso's second win in Barcelona -- the first coming in 2006 -- and his seventh career podium on the Circuit de Catalunya.

"It's very special winning at home and it doesn't matter how many times you repeat it," Alonso said. "Very long last laps because you want to finish as quickly as possible. Difficult qualifying as we were not too quick yesterday but we knew we had the pace on the long runs. We did it and everything worked perfect."

More importantly, the two-time former champion closed the gap on Vettel from 30 to 17 points, moving up to third overall. Raikkonen is only four points behind Vettel, who leads with 89 after five races.

Mercedes had a disappointing day after Nico Rosberg and Lewis Hamilton started on the front grid. As has been the case this season, the Mercedes cars -- which are fast in qualifying -- again lacked race pace and durability as both drivers quickly dropped back. Rosberg finsihed sixth and Hamilton drifted way back to 12th and was a lap off the pace.

Hamilton made a terrible start as Vettel flew past him at the first corner and Alonso found a small gap to surge past Raikkonen on turn one and then past Hamilton on the outside of turn three to move quickly into third.

"We have just got a lot to do to catch up with the others, but we will get there," Hamilton said.

Jenson Button's miserable weekend looked set to continue as he drifted down from 14th to 17th, although he salvaged some pride with a credible eighth-place finish, holding off a late surge from teammate Sergio Perez to finish behind Paul di Resta.

The next race is the Monaco GP next Sunday.