The Irishman was the first rider able to open a gap on the finishing climb, and endured an agonising final run to the line as Pierre Latour (Ag2r La Mondiale) attacked behind.
>> Subscribe to Cycling Weekly this Autumn and save 35%. Enjoy the luxury of home delivery and never miss an issue <<
Latour almost made it across to Martin by the finish, but Martin held on to go one better than he managed on the same finish three years ago.
Most of the general classification came across the line at three seconds with Alejandro Valverde (Movistar) leading them across the line.
There was a small time loss for Chris Froome (Team Sky), who was three seconds behind his main rivals, but this was minor damage compared to some of the other GC contenders.
Romain Bardet (Ag2r La Mondiale) suffered a puncture with three kilometres to go and chased hard to get back on before being dropped 1.5km from the line to finish 31 seconds down.
However Tom Dumoulin (Team Sunweb) was the big casualty of the day, puncturing on the fast run in to the climb with 5.5km to go and losing 53 seconds to drop from seventh to 15th overall.
As for the yellow jersey, Greg Van Avermaet (BMC Racing) finished in the group at three seconds to maintain his race lead.
How it happened
The sixth stage of the Tour de France saw the riders face another lumpy parcours with an uphill finish to Mûr de Bretagne, and with the Breton flags out in force at the side of the ride it was no surprise to see a local rider, Laurent Pichon of Fortuneo-Samsic), among those in the break.
Alongside Pichon were three more Frenchmen in Damien Gaudin and Fabien Grellier (Direct Energie) and Anthony Turgis (Cofidis), as well as New Zealander Dion Smith (Wanty-Groupe Gobert) who was looking to retake the polka dot jersey that he had yielded to Toms Skujins (Trek-Segafredo) on Wednesday.
Those five riders worked well through the early stages to extend their lead over a relaxed peloton out beyond six minutes, before Smith swept up the two points on offer at the top of the fourth category Côte de Ploudiry after 44km.
However the stage turned interesting with 102km to go as the road changed direction and Quick-Step Floors saw the chance to force a split. For a moment there were major splits in the peloton with riders battling in echelons.
That acceleration saw a group of around 50 riders go clear, with all of the major contenders apart from Primoz Roglic (LottoNL-Jumbo) making the split, and in the process wiping two minutes off the break’s lead in the matter of seven kilometres.
As Quick-Step continued to drive the pace the gap to the Roglic group at one point reached two minutes. However a big effort by his team helped him regain contact with 74km to go as the gap to the front of the race came down to just 2-15.
But no sooner had he regained contact than Roglic suffered more misfortune as he crashed with 70km remaining, being the only rider to come down as the peloton negotiated a central reservation. Once again the Slovenian was forced to do some chasing and got back in a little while later.
From there the racing settled down a little with the gap to the break continuing to hover at around two minutes.
That gap wasn’t enough for Gaudin who pressed on alone shortly after the intermediate sprint with 46km to go to leave his erstwhile breakaway companions. Meanwhile Alexander Kristoff (UAE Team Emirates) led Fernando Gaviria (Quick-Step Floors) and Peter Sagan (Bora-Hansgrohe) across the line at the intermediate sprint to pick up the remaining points.
Gaudin was soon caught by the rest of the break whose lead remained around two minutes for a while, but as the Mûr approached the pace went up behind with Dimension Data, BMC Racing, and Quick-Step all fighting for position at the front of the peloton, and Jakob Fuglsang (Astana) was brought down in a crash.
Fuglsang had a fight to get back to the peloton with no fewer than six riders in front of him, only making contact as the peloton approached the first climb of the Mûr de Bretagne with 19km remaining.
While Fuglsang had been chasing there had been more attacks in the break, where Grellier went solo to take on the climb alone with a 32 second lead on the peloton.
However the dead-straight climb meant that the peloton was soon sweeping up the rest of the break and had Grellier in its sight with Team Sky leading it up.
Grellier was caught with a kilometre still to go on the climb, meaning that the polka dot jersey of Toms Skujins was able to jump out to take maximum points at the top.
Second over the line was Jack Bauer (Mitchelton-Scott) who continued to push on as Skujins sat up to wait for the bunch, soon opening a lead of 30 seconds.
That meant that Bauer took the three second bonus at the bonus sprint point with 12.8km to go, before Geraint Thomas (Team Sky) jumped out of the bunch to take the two seconds bonus for second place to move within three seconds of Greg Van Avermaet’s yellow jersey.
With plenty of teams trying to stay at the front of the bunch the gap to Bauer soon came down to just 15 seconds, with most of the damage being done by Bora-Hansgrohe.
The pace was high and Bauer soon caught as Tom Dumoulin (Team Sunweb) suffered a puncture at the worst possible moment with 5.5km to go, receiving a wheel from team-mate Simon Geschke and being quickly back underway but already trying to close a 40 second gap.
With no team-mates around him Dumoulin took advantage of the slipstream offered up by his team car to move back into the convoy, while Romain Bardet (Ag2r La Mondiale) also punctured but was able to regain contact.
However Dumoulin, now with two team-mates alongside him, was still off the back by 30 seconds while Michal Kwiatkowski (Team Sky) continued to apply pressure on the front on the run-in to the finishing climb.
The straight road meant Dumoulin had the peloton agonisingly in his sights, but the pace wasn’t slackening as Daniel Oss (Bora-Hansgrohe) led the group up with Julian Alaphilippe (Quick-Step Floors) in second wheel looking over his shoulder.
However it was the GC contenders who launched the first attacks as Richie Porte (BMC Racing) launched the first move before Dan Martin (UAE Team Emirates) counter-attacked to open a gap.
The chase was lined out with Adam Yates (Mitchelton-Scott) and Porte leading them up, while there was bad news for French fans as Bardet was dropped.
Martin’s lead was slender as Porte continued to lead in the final 500m, before a counter from Pierre Latour made it across to Martin.
In sight of the line Later was nearly in Martin’s slipstream, but couldn’t quite make it across as Martin held on to win the stage by a handful of seconds ahead of the GC group.
Alejandro Valverde (Movistar) led the GC group home at three seconds while Chris Froome (Team Sky) was tailed off slightly a further five seconds back.
However Froome’s time loss was minor compared to Bardet, who crossed the line at 31 seconds, while Dumoulin was helped home by Søren Kragh Andersen almost a minute down.
In all of that the yellow jersey of Greg Van Avermaet was safely ensconced in the GC group, and with none of his rivals able to take any bonus seconds on the finish line the Belgian looks set to take the yellow jersey at least as far as the Roubaix cobbles on stage nine.
Tour de France 2018, stage six: Brest to Mûr de Bretagne, 181km
1. Daniel Martin (Ire) UAE Team Emirates, in 4-13-43
2. Pierre Latour (Fra) Ag2r La Mondiale, at 1 sec
3. Alejandro Valverde (Esp) Movistar, at 3 secs
4. Julian Alaphilippe (Fra) Quick-Step Floors
5. Rafal Majka (Pol) Bora-Hansgrohe
6. Adam Yates (GBr) Mitchelton-Scott
7. Bauke Mollema (Ned) Trek-Segafredo
8. Peter Sagan (Svk) Bora-Hansgrohe
9. Geraint Thomas (GBr) Team Sky
10. Primoz Roglic (Slo) LottoNL-Jumbo, all at same time
General classification after stage six
1. Greg Van Avermaet (Bel) BMC Racing Team, in 22-35-46
2. Geraint Thomas (GBr) Team Sky, at 3 secs
3. Tejay van Garderen (USA) BMC Racing, at 5 secs
4. Julian Alaphilippe (Fra) Quick-Step Floors, at 6 secs
5. Philippe Gilbert (Bel) Quick-Step Floors, at 12 secs
6. Bob Jungels (Lux) Quick-Step Floors, at 18 secs
7. Rigoberto Uran (Col) EF Education First-Drapac, at 45 secs
8. Alejandro Valverde (Esp) Movistar, at 51 secs
9. Rafal Majka (Pol) Bora-Hansgrohe, at 52 secs
10. Jakob Fuglsang (Den) Astana, at 53 secs