Heat is on as 17,000 set a new record for marathon
Hundreds of thousands of spectators lined the pavements to watch the runners, while more cheered them on at the finishing line at Musselburgh Racecourse.
Temperatures of up to 22 degrees Celsius took their toll. Ten people had to be taken to hospital, after collapsing due to heat-related problems and 160 were treated by medical staff at the scene.
Some water stations ran out of supplies and staff used motorbikes to distribute water to runners who had missed out.
A total of 8,260 runners completed the marathon, out of 13,104 entrants, with a further 4,060 completing the relay race.
Many of the entrants ran for charity, helping raise around 3.5 million for more than 200 good causes.
A 31-year-old policeman, from the West Midlands, was the fastest man to complete the race.
Martin Williams,. who competes for Scotland through his Scottish parentage beat the British No 1 marathon runner Andi Jones by 24 seconds.
Mr Williams finished in 2 hours 18 minutes and 24 seconds, making him eligible to represent Scotland in next year's Commonwealth Games.
He said: "I expected to struggle in the heat, but it wasn't as bad as I'd thought. Today I just seemed to get stronger. I had a couple of mental blocks, at 18 miles and 22 miles, but I managed to get through them. It was just me and Andi in the lead for most of the race."
He was presented with a specially commissioned new trophy, which features around 2,500 Swarovski crystals, and 1,000 in prize money.
He was also given 500 as the fastest Scot, and a 750 time-related bonus.
The fastest woman to finish the course was Holly Rush, from Bradford-upon-Avon, who ran the course in two hours, 41 minutes and 38 seconds. She was followed by Toni McIntosh, who had worked for the Edinburgh Marathon in 2005, but now lives in Ayr.
Jennifer Maclean from Edinburgh, was in third place.
The Hairy Haggis relay race, was won by Edinburgh's Napier University with a time of 2:25:00, four minutes clear of the second place Perth Flyers.
The final competitor to cross the line was Shato Qadir a Kurdish amputee who completed the course on crutches.
Event marketing manager, Damien O'Looney, said the organisers were delighted by the success of the event.
He said: "We've doubled in size in three years. We've put a lot of work into improving it each year, and we get about 4,500 questionnaires back from runners after each race.
"I think you get the best of both worlds, as you run through the city and the countryside."
Although some stations had run out of water, he said there had been plenty to go round. "We plan for this type of weather - 2006 was even hotter," he said.
The event's chief executive Geoff Sims said: "I'm delighted by the turnout. People do recognise the Edinburgh Marathon is one of the best in the world, and they've voted with their feet. It's really, really disappointing that the heat got hotter and hotter..
"For the vast majority it just makes it that much harder. It makes it significantly harder for the staff as well."
In the later stages of the afternoon, marathon officials decided to shorten the route at the Gosford turning point to protect the slower runners, some of whom were struggling in the heat.