NANCY, France -- Matteo Trentin of Italy won Friday's seventh stage of the Tour de France in a photo finish, after a group crash and a hilly final section split the pack.

Fellow Italian Vincenzo Nibali retained the overall lead. U.S. rider Tejay van Van Garderen, who crashed within the last 10 1/2 miles, was the big loser on the day -- with his fall costing him more than a minute in the title chase.

The sun finally broke through clouds that had dumped rain over riders in recent days for the 146-mile ride from Epernay, the capital of Champagne country, to the eastern city of Nancy.

Trentin, a 24-year-old rider who won a stage in the Tour of Switzerland earlier this year, beat Slovakia's Peter Sagan by what looked like inches on the finish-line photo of the final sprint.

Trentin patted the Cannondale rider on the back after crossing the line. Sagan, who has come close several times, has yet to win a stage this year.

France's Tony Gallopin was third.

BMC leader van Garderen was not the only American to have a bad day. Andrew Talansky fell in the final sprint, rolling over and scuffing up his left arm after getting hit by Australia's Simon Gerrans.

But under course rules, Talansky, the Garmin-Sharp team leader, didn't lose time in the title chase because his crash happened within the last 3 kilometers (1.9 miles). He yelled in frustration after crossing the line.

Overall, Nibali has a two-second lead over Astana teammate Jakob Fuglsang and is 2 minutes, 37 seconds clear of Alberto Contador, his main rival. Talansky is eighth, 2:05 behind.

"There have really been a lot of crashes this year, in the final sprints," Nibali said. "We all knew that Sagan wanted a win today. . . . The end of the stage was very hard."

With about 10 miles left, a Movistar rider bumped the back wheel of van Garderen as he moved to the right in the pack. They tumbled to the asphalt, and van Garderen got rolled over by another rider's bike.

The BMC leader got up and back into the race, but lost time to the race contenders -- even after several of his teammates dropped back to try to help him catch up.

Overall, van Garderen is 3:14 behind Nibali, in 18th place, after starting the stage 2:11 adrift.

Contador led a small attack on a low-grade climb with a little less than four miles left, but couldn't shake Nibali. The Italian says he expects the Spanish two-time champ to attack in the mountains ahead this weekend.

A shakeout among the title contenders could be ahead in Saturday's eighth stage, which winds through medium-height mountains along a 100-mile course from Tomblaine to Gerardmer La Mauselaine.