World champion Philippe Gilbert of Belgium won stage 12 of the Vuelta a Espana on Thursday and Italy's Vincenzo Nibali retained the overall lead.

Gilbert attacked in the last 250 metres to outpower Norway's Edvald Boasson Hagen with Argentina's Maximiliano Richeze leading the bunch in for third.

As Gilbert celebrated his first victory of the year, Italy's Vincenzo Nibali remained in the overall lead for a second successive day ahead of Ireland's Nicolas Roche and Spain's Alejandro Valverde.

The Vuelta finishes in Madrid on September 15.