Norwegian Boasson Hagen blasted away as the pack struggled on a short but punishing rise to the finishing straight in the coastal town of Tarragona but was powerless to stop Gilbert zipping past.
The Belgian made repeated thumbs-up signs to the television cameras afterwards in celebration.
"I was thinking just one word - 'finally' - as I came over the line, because I've come very close a few times but this year has been very difficult," Gilbert told reporters.
"Also there was a lot of pressure with the world championships so soon, so the situation was getting intense.
"Everybody wanted me to win, they wanted to see that first time finally arrive, so you can say it was a very great moment to be able to get that victory," added the 31-year-old.
Following his spectacular 2011 season, with 18 victories including three top Spring Classic races, Gilbert had to wait until late August for his first win in 2012, a stage in the Tour of Spain in nearby Barcelona, before going on to triumph in the world championships
"This victory will really increase the pressure on me for the world championships (in Florence, Italy on September 29) and on a course like that a lot of people will say I can win again," the BMC rider reflected.
"But I don't see why I should be the only favourite, I could name 10 other riders who might win."
Asked why he had had such a dearth of victories this season, Gilbert, who lost stage seven of the Vuelta to Czech Zdenek Stybar by centimetres, said:
"All careers have a high point and mine was 2011, although now I'm still racing at a high level.
"I've always been close to the win, the only difference is win or don't. It's a few percentage power points (which make the difference) and it's not easy to stay on the highest level for years."
1. Philippe Gilbert (Belgium / BMC Racing) 4:03:44"
2. Edvald Boasson Hagen (Norway / Team Sky) ST
3. Maximiliano Richeze (Argentina / Lampre)
4. Luca Paolini (Italy / Katusha)
5. Gianni Meersman (Belgium / Omega Pharma - Quick-Step)
6. Francesco Lasca (Italy / Caja Rural)
7. Steve Chainel (France / AG2R)
8. Reinardt Janse Van Rensburg (South Africa / Argos)
9. Anthony Roux (France / FDJ.fr)
10. Zakkari Dempster (Australia / NetApp)
1.Vincenzo Nibali (Italy / Astana) 45:26:06"
2. Nicolas Roche (Ireland / Saxo - Tinkoff) +31"
3. Alejandro Valverde (Spain / Movistar) +46"
4. Chris Horner (U.S. / RadioShack)
5. Joaquim Rodriguez (Spain / Katusha) +2:33"
6. Domenico Pozzovivo (Italy / AG2R) +2:41"
7. Ivan Basso (Italy / Cannondale) +2:52"
8. Thibaut Pinot (France / FDJ.fr) +3:35"
9. Rafal Majka (Poland / Saxo - Tinkoff) +3:46"
10. Daniel Moreno (Spain / Katusha) +3:56"
- Sports & Recreation
- Boasson Hagen
- Alejandro Valverde
- Nicolas Roche
- Vincenzo Nibali