Philippe Gilbert made a solo charge to win the 12th stage of the Spanish Vuelta in Basque Country on Thursday, while Primoz Roglic finished in the peloton to hold on to the leader's red jersey.

Gilbert broke away near the end to comfortably take the victory in the 171-kilometer (106-mile) stage that finished in Bilbao. The Belgian rider from team Deceuninck-Quick Step finished three seconds ahead of Spaniards Alex Aranburu and Fernando Barceló.

Roglic successfully fended off an attack by Colombian Miguel Ángel López to finish safely in the peloton, which crossed the line more than three minutes after Gilbert.

Deceunink -Quick's Team Philippe Gilbert of Belgium celebrates on the podium after winning the stage during the 12th stage between Circuito de Navarra- Los Arcos and Bilbao, 171,4 kilometers (106,50miles), of the Spanish Vuelta cycling race that finishes in Bilbao, northern Spain, Thursday, Sept.5, 2019. (AP PhotoAlvaro Barrientos)

Deceunink -Quick's Team Philippe Gilbert of Belgium celebrates on the podium after winning the stage during the 12th stage between Circuito de Navarra- Los Arcos and Bilbao, 171,4 kilometers (106,50miles), of the Spanish Vuelta cycling race that finishes in Bilbao, northern Spain, Thursday, Sept.5, 2019. (AP PhotoAlvaro Barrientos)

Roglic maintained a gap of 1 minute, 52 seconds to second-place Alejandro Valverde, with López staying another 19 seconds behind. Nairo Quintana was three minutes off the overall lead.

Riders will face several mountain passes in an extremely challenging stage on Friday, including a daunting final climb in Los Machucos.

More AP sports: https://apnews.com/apf-sports and https://twitter.com/AP_Sports

Spain La Vuelta red shirt leader's Jumbo's Team Primoz Roglic, holds a trophy at the end of the stage during the 12th stage between Circuito de Navarra- Los Arcos and Bilbao, 171,4 kilometers (106,50miles), of the Spanish Vuelta cycling race that finishes in Bilbao, northern Spain, Thursday, Sept.5, 2019. (AP PhotoAlvaro Barrientos)

Spain La Vuelta red shirt leader's Jumbo's Team Primoz Roglic, holds a trophy at the end of the stage during the 12th stage between Circuito de Navarra- Los Arcos and Bilbao, 171,4 kilometers (106,50miles), of the Spanish Vuelta cycling race that finishes in Bilbao, northern Spain, Thursday, Sept.5, 2019. (AP PhotoAlvaro Barrientos)

Deceunink -Quick's Team Philippe Gilbert of Belgium celebrates on the podium after winning the stage during the 12th stage between Circuito de Navarra- Los Arcos and Bilbao, 171,4 kilometers (106,50miles), of the Spanish Vuelta cycling race that finishes in Bilbao, northern Spain, Thursday, Sept.5, 2019. (AP PhotoAlvaro Barrientos)

Deceunink -Quick's Team Philippe Gilbert of Belgium celebrates on the podium after winning the stage during the 12th stage between Circuito de Navarra- Los Arcos and Bilbao, 171,4 kilometers (106,50miles), of the Spanish Vuelta cycling race that finishes in Bilbao, northern Spain, Thursday, Sept.5, 2019. (AP PhotoAlvaro Barrientos)