NEW York’s Mayor has declared “terrorists won’t win” after hundreds of thousands of rush-hour commuters were caught up in an Islamic State inspired pipe bomb attack at the world’s busiest bus terminal – the second the city has faced in weeks.

The lone attacker’s bomb failed to detonate according to plan in an underground station walkway at the New York Port Authority hub leaving three people with minor injuries.

The death toll would almost certainly have been New York’s worst from a terror attack since 9/11 had his plan succeeded.

The blast – which also injured the attacker – caused widespread chaos as people fled the scene and forced the temporary closure of the bus terminal. The area of subway affected was completely cleared of people.

CCTV showed the suspect with his clothes ripped and cuts on his upper body lying on the ground of the walkway, which lies near to Times Square.

Armed police were waiting to question the suspect Akayed Ullah, 27, as he was treated at the city’s Bellevue Hospital for burns to his hands and abdomen.

Speaking at the scene, close to where eight people died after a man – again said to be inspired by IS – mowed down cyclists and pedestrians in October in a pick up truck, Mayor Bill de Blasio said: “This was an attempted terrorist attack. Thank God the perpetrator did not achieve his ultimate goals.”

Police Commissioner James O’Neill declared: “We are New Yorkers; we don’t live in fear.”

The blast took place on an underground walkway connecting subway lines, beneath 42nd Street between Seventh and Eighth avenues at 7.20am.

Dozens of emergency vehicles and first responders were on the scene within minutes and surrounding streets were closed as subway lines were evacuated. Rail and bus services at the nearby Port Authority bus terminal were at a standstill in the immediate aftermath.

Police responding to the scene found an injured man wearing an improvised, low-tech explosive device he had “intentionally detonated,” added Commissioner O’Neill.

The blast came at a time when the area was packed with commuters and holiday tourists in a city still on edge following the earlier incident.

Christina Bethea, 29, a security guard from Yonkers, a New York City northern suburb, said she was getting off a southbound 1 line subway train en route to work when she heard a loud noise. “I heard boom and saw smoke and we all started running up the steps,” Ms Bethea said. “It sounded like a loud gunshot.... When you hear a boom and see smoke, that means get the hell out of there.”

She called colleagues to make sure they weren’t harmed and let friends know she was unscathed. “I’m alive. That’s all that matters to me,” she said. “I said, damn, I’m gonna move back to North Carolina. New York City is too much for me.”

Andre Rodriguez, 62, added: “I was going through the turnstile. It sounded like an explosion, and everybody started running.”

Alicja Wlodkowski, said she witnessed 60 people fleeing scene in the chaos, adding: “A woman fell. And nobody even went to stop and help her because the panic was so scary.”

New Jersey Transit passenger Nadine Hovan sat on her bus looking out onto Eight Avenue, alarmed to see scores of people with their phones up in the air.

Once inside the bus terminal, she heard people yelling to get out of the building. “That is when people start to get a little crazy,” she said.

She said she did not panic – but added that she might have if she knew what had been going on. She also said the attack wouldn’t intimidate her from returning to the city. “You got to live your life,” she said. “You got to work. You can’t stay locked up in your house all the time.”

Less than three hours after the blast, officials said all trains and buses were running, although the area around the blast was being bypassed.

Governor Andrew Cuomo said the city’s residents understood it was an international target “for many who would like to make a statement” against freedom.

He said: “This is New York. The reality is that we are a target by many who would like to make a statement against democracy, against freedom.

“We have the Statue of Liberty in our harbour and that makes us an international target.”

“The reality turned out better than the initial expectation and fear.”

President Donald Trump was briefed on the incident at the White House.

Republican congresswoman Nydia Margarita Velázquez, whose district includes part of lower Manhattan, tweeted that she wanted to “salute and thank” the police, fire and first responders “for their swift response to the explosion”.

Following the October 31 attack in lower Manhattan, Sayfullo Saipov, a 29-year-old Uzbekistan native and New Jersey resident, was charged with providing material support to IS, which claimed responsibility Victims included five Argentinian friends enjoying a trip to the city to celebrate the 30th anniversary of their graduation.