Five days after the worst attack on New York since September 11, 2001, the city heavily bolstered security for the race with some 2.5 million people packing the streets.
Five days after the worst attack on New York since September 11, 2001, the city staged a show of defiance on Sunday, with some 2.5 million people packing the streets to cheer on 50,000 marathon participants from around the world.
Kenya's Geoffrey Kamworor won the New York City Marathon men's title, taking his first victory at the distance as the race took place just five days after a deadly Manhattan truck attack left eight people dead.
Two years after losing the lead late in the 42.1 kilometre (26.2-mile) race, Kamworor held off compatriot Wilson Kipsang to win in an unofficial time of 2hrs 10mins 53secs.
Kipsang, the 2014 New York champion, was three seconds back with Ethiopia's Lelisa Desisa third in 2:11:32.
Kamworor, 24, was in only his seventh marathon. He settled for second in 2015 to Kenyan Stanley Biwott after being overtaken late in the race.
Kipsang, 35, won in Tokyo earlier this year and raced in September's Berlin Marathon but quit after 30 km.
Expanded security lined the route of the world-famous race, which saw an estimated 50,000 runners from more than 125 nations compete across the Big Apple streets.
Flanagan scores stunning victory
Shalane Flanagan became the first American woman to win the New York City Marathon in 40 years when she claimed a dominant victory over Kenyan three-times champion Mary Keitany on Sunday.
Flanagan, who had never won a major marathon, clocked an unofficial two hours, 26 minutes 53 seconds for a stunning victory at the age of 36.
Keitany struggled home in 2:27:54 with Ethiopia's Mamitu Daska third in 2:28:08.
Kamworor finished in an unofficial 2:10.53 with Kipsang three seconds behind.
Security at an all-time high
The city heavily bolstered security for the race, parking massive sand trucks to prevent vehicle attacks, stationing extra police on rooftops and deploying more anti-sniper units.
Hundreds of uniformed officers stood guard along the route, while plainclothes officers blended in with the crowds of spectators.
President Donald Trump insisted in an interview that aired Sunday, as he began an extended Asia trip, that Americans need never accept terrorism as inevitable.
"We cannot just say, 'Oh well, it's going to happen, let's get used to it.' We cannot allow it to happen," he said on the Full Measure syndicated television show. "I can tell you, the Trump administration is getting tougher and tougher and tougher."
But awareness of the potential threat was a constant in New York on Sunday. In iconic Central Park, where the race ends, a woman's amplified voice offered a repeated warning even before the race began: "Stay alert at all times."
TRT World's Nick Harper has more details about the security arrangements.
'It did make me anxious'
Security in New York had already been boosted in 2013 after the Boston marathon attack that saw two youths of Chechen descent plant two bombs near the finish line, killing three people and wounding more than 250 others, including spectators.
Daesh terror group has described Sayfullo Saipov - the 29-year-old man charged with driving a rented pickup truck down a crowded bike path in Manhattan on Tuesday - as one of its own, prompting Trump to call for his execution.
As Sunday's marathon began, New Yorkers said they were coming together in defiance in the aftermath of the latest attack to strike America's most populous city.
In the Bay Ridge neighbourhood of Brooklyn, Jean Schnell was waiting to see her daughter run past. Tuesday's attack made her nervous, she admitted, especially because she is from Boston.
"It did make me anxious about coming to New York, and her running, but we were going to come support her anyway, so it didn't really make any difference," she said.
"I think today you have to live your life."