A crude pipe bomb strapped to a man inspired by the Islamic State group went off on Monday in a crowded subway corridor near Times Square, injuring the man, slightly wounding three others and disrupting the rush-hour commute for hundreds of thousands of New York workers.

Surveillance cameras captured the man walking casually through the crowded passageway when the bomb suddenly went off at 7:20 a.m. amid plume of white smoke, which cleared to show the man sprawled on the ground and commuters fleeing in terror.

Investigators said it was not clear if the bomb was set off intentionally or went off prematurely.

"This was an attempted terrorist attack," New York's mayor Bill de Blasio told reporters.

"Thank God the perpetrator did not achieve his ultimate goals."

The suspect, who was identified as 27-year-old Akayed Ullah, was being treated at a hospital for burns to his hands and abdomen.

The others who were injured suffered ringing in the ears and headaches.

Law enforcement officials said Ullah was inspired by the Islamic State group but had apparently not had any direct contact with the group.

The explosion, which happened in an underground passageway under 42nd Street between Seventh and Eighth avenues, triggered a massive emergency response by police and firefighters both above and below ground, affecting subway and bus service at the nearby Port Authority bus terminal.

Everything around Times Square was shut down, halting what would ordinarily be a bustling rush hour.

Authorities said the bomb was a low-tech explosive device attached to the man with Velcro and cable ties.

They were investigating how it was made.

A photo published by the New York Post showed a bearded man crumpled on the ground with his shirt apparently blown off and black soot covering his bare midriff.

A police officer was holding the man's hands behind his back.

Another photo shown on cable channel NY1 showed the bearded suspect, wide-eyed, on a stretcher being loaded into an ambulance.

Elrana Peralta, a customer-service worker for Greyhound, said she works in the Port Authority terminal complex near where the blast happened but did not hear the explosion.

"All we could hear was the chaos," she said.

"We could hear people yelling, 'Get out! Get out! Get out!'"

John Miles, 28, from Vermont, was waiting for a bus to Massachusetts.

He did not hear the blast either, but saw police react.

"I didn't know what was going on. Officers were running around. I was freaking out," he said.

There was an announcement that people should take their bags and leave.

"They didn't incite panic. It was fairly orderly."

White House press secretary Sarah Huckabee Sanders tweeted that President Donald Trump had been briefed on the explosion.

Instead of commenting on the suspected terror attack, Mr Trump later sent a tweet at 9:17am criticising a Sunday story in The New York Times that said he watched cable news television for at least four hours a day.

The blast came just weeks after eight people died in New York when another man, also said to be inspired by the Islamic State, drove a rented vehicle onto a bike path near the World Trade Centre.

Governor Andrew Cuomo said at a news conference following the attack that New Yorkers should be alert but go about their lives.

"Let's go back to work," he said.

"We're not going to allow them to disrupt us."