Cycling:Froome retains his grip as Martin claims Tour de France's yellow jersey

CAMBRAI, FRANCE (Reuters) - Chris Froome lost his yellow jersey but retained his grip on his rivals after surviving a day on the cobbles in the Tour de France on Tuesday.

German Tony Martin won the fourth stage with a late attack and snatched the overall lead at the end of a body-punishing 223.5-km ride from Seraing, Belgium.

Team Sky rider Froome was expected to be tested on the seven cobbled sectors that peppered the course, as the Tour entered France for the first time since the grand depart in Utrecht, Netherlands, and he passed with flying colours.

The Briton almost fell off his bike after being slightly elbowed by Italian Jacopo Guarnieri, his front wheel hitting a kerb, but he regained control and soldiered on in impressive fashion.

The 2013 champion, who crashed out of last year's Tour just ahead of the first cobbled sectors, even accelerated in the finale, showing he was in top shape as he stamped his authority on the race.

Martin leads Froome by 12 seconds overall with American Tejay van Garderen, another contender for the overall victory, in third place 25 seconds off the pace.

Vincenzo Nibali and his Astana team-mate Lars Boom attacked repeatedly on the cobbles, hoping to shake Froome but all the defending champion got was the prize for the most aggressive rider of the day.

Among the other top favourites, Spain's Alberto Contador and Colombian Nairo Quintana could only follow, but stayed in contention as the most treacherous part of the race is now behind them.

Contador is in eighth spot 48 seconds behind Martin. Nibali is in 13th position, 1min 50sec off the pace and Quintana lies 17th, 18 seconds further back.

A four-man breakaway built an eight-minute advantage but they never had a chance as Team Sky took control of the peloton just ahead of the first cobbled sector, dramatically upping the pace.

The peloton was eventually skimmed to about 30 riders after Frenchman Thibaut Pinot, who had already lost a chunk of time on Monday, was ruled out of contention for good in this Tour following two mechanical failures.

Martin powered away with 3km left and the triple time-trial world champion never looked back.

His compatriot John Degenkolb sprinted for second ahead of Slovakia's Peter Sagan.