EAST VILLAGE — A gas explosion Thursday afternoon engulfed four buildings in flames, causing one to collapse and another to partially fall, authorities said.

At least 12 people were injured in the blast at Second Avenue and East 7th Street — seven were taken to Bellevue and Weill-Cornell hospitals and three were in critical condition with burns to their airways, Mayor Bill de Blasio said.

"We are praying that no other individuals are injured," the mayor said.

Witnesses going about their afternoon routines were shaken without warning by the 3:17 p.m. blast, according to fire officials and residents.

"It was like a bomb," said Aleksandar Srdic, 32, who lives around the corner. "Everyone was like what's going on? People from Starbucks were yelling to get back inside and they were trying to lock the doors."

The initial explosion occurred at 121 Second Ave., hurling the front of the building across Second Avenue, officials said.

"That building is in danger of possible collapse," FDNY Commissioner Daniel Nigro said.

Fire caused by the explosion spread to 123 Second Ave., which was reduced to rubble, as 125 Second Ave and 119 Second Ave. were engulfed in flames.

Firefighters initially pressed into the building to help survivors, but were beaten back by flames.

Con Edison shut down gas service to the area, spokesman Allan Drury said.

A preliminary investigation points to gas work in the basement of 121 Second Ave., Office of Emergency Management Commissioner Joseph Esposito said.

Con Edison inspectors were at the building at 2 p.m. Thursday to check on a meter installation, according to the utility's president, Craig Ivey. The unit did not pass inspection and gas was not turned on to the meter, he said.

"We had no reports of gas odors in the area prior to the fire and explosion. A survey conducted yesterday of the gas mains on the block found no leaks. We continue to work with all agencies on the investigation into the cause, and we are praying for the recovery of all the injured," Drury said in an email.

James Coll, 24, who lives nearby, was home at the time of the explosion.

"I was in my apartment. The whole building shook," he said, adding he ran out of his building in just a pair of shorts and a blazer.

Construction worker Julian Latham, 35, who was working on East 7th Street, described the chaos.

There was a man lying on the ground outside a restaurant with a table and chairs overturned. People rushed out of the building, he said, as a woman climbed down the fire escape ladder.

"The people who came out, everyone had blood on their face," Latham said. "We were trying to pull the fire escape ladder to get the lady down."

He said she eventually escaped injury.

The acrid smell of smoke reached Union Square and even further uptown, witnesses said.

Officials said air quality tests were underway, but recommended that residents keep their windows closed and limit outdoor exposure.

A relief station at P.S. 63 at 121 East 3rd St. was set up quickly to help evacuees and displaced residents.

Major explosion on 2nd ave and 7th street. New Yorkers being awesome and helping this young lady get down! pic.twitter.com/YxGh2C68IP — Niraj Desai (@nayramz) March 26, 2015

Additional reporting by Lisha Arino, Gwynne Hogan, Ben Fractenberg and Danielle Tcholakian.