Omega Pharma-Quick Step's Matteo Trentin won Stage 7 of the Tour de France, beating Peter Sagan (Cannondale) by a matter of millimetres.

It was the third time Sagan, wearing the green jersey of the leader of the points classification, had been beaten at the last in the opening week of the race.

Sagan had earlier gone on the attack with Greg Van Avermaet (Lotto-Belisol) but the duo could not make it stick and were quickly swept up by the peloton.

The Slovak was recovering from two crashes in two days, having hit the tarmac on both Stages 5 and 6.

He looked to have shaken off his scrapes and bruises, but despite dragging himself back to the front of the peloton after his failed attack, he was defeated in agonising fashion by Trentin.

So often a lead-out man for his team-mates, the Italian enjoyed his moment in the limelight to add to the stage victory he won in last year's Tour.

“At first I didn’t know if I’d won. It was so close that I wasn’t sure,” Trentin said.

“I congratulated Peter because I thought it was him. From 50 meters out I saw him arriving like a bullet.

"It was really a sprint down to the last centimeter; I’ve seen the photo finish and there’s only a centimeter in it.”

Sagan was disappointed not to win the stage, but reiterated that his main desire was to hold onto the green jersey.

“I tried to attack after the last KOM with Van Avermaet,” he said.

“When I saw the group coming fast I just waited for the sprint. Unfortunately, my effort was not enough. When I win, many people say that for me it’s easy [to] do it, but today’s stage proves that it’s always hard being the first.

"Since the first stage, every day I’m among the main contenders, and now I wear the green jersey with a good advantage.

"This is a positive aspect, but I want something more. I know there will be other chances until Paris, and I think that my day will arrive.”

Astana's Vincenzo Nibali retains his overall lead, with team-mate Jakob Fuglsang lying in second, two seconds behind.

Saturday's route sees the riders tackle a 161 kilometre route from Tomblaine to Gérardmer La Mauselaine.