Bangladeshi rescuers pulled a woman alive from the ruins of a collapsed garment factory complex on Friday after she spent 17 days trapped in a basement under the rubble.

Hours after officials had announced the death toll had surged past the 1,000 mark, recovery teams who had long given up any hope of finding more survivors were stunned to hear the voice of a woman calling for help.

They managed to extract her from the ruins in an operation broadcast live on television and watched by crowds at the scene who were asked by clerics to pray for her.

Cries of “Allahu Akbar” - “God is great” - rang out from the crowd as the woman, identified as Reshma, emerged.

After she was brought to the surface she was whisked away to a waiting ambulance, but managed a weak smile to the people gathered at the ruined Rana Plaza complex on the outskirts of the capital Dhaka.

“I called, but nobody listened to me. I heard some noises, but nobody listened to me,” she told Somoy TV later in an interview. Rescuers said she appeared to have lost a lot of weight but there were no other signs of injury. Her family, from a remote northern village, was elated at her survival.

“It was a miracle. We lost all hopes of finding her alive. We visited every hospital in Dhaka and Savar. We visted the mortuaries and checked every dead body they pulled out,” Reshma’s brother, Zahidul Islam, said.

A doctor at the Savar Combined Military Hospital said that Reshma appeared to be in good health despite her ordeal. “Her heart is fine. Her breathing is fine. Her brain is functioning well. We (will know more) after getting her biochemical report,” he said.

Bangladesh’s fire service chief Ahmed Ali told AFP that Reshma was found in a gap between a beam and column in the wreckage of the nine-storey complex, which caved in on April 24, and appeared to have had access to water. The army officer who brought Reshma out of the rubble said she had been found standing amid the ruins.

“We first saw a pipe moving. We removed some gravel and concrete. We found her standing,” Major Moazzem, who uses only one name, told Somoy TV.

“We gave her food and assured her she would be rescued. We conducted the rescue work for 45 minutes. We brought her out by using light hammers, hand saws and drilling machines.”

Jamil Ahmed, a fire service officer who was part of the rescue team, told AFP the bulldozers and cranes which had been turning over the rubble in search of bodies were ordered to stop as soon as it was learnt Reshma was alive.

“We dug a hole and there she was - standing up. She told us: ‘My name is Reshma, please save me, please save me, brother’,” he said.

“There was an air pocket inside and she had enough space to crawl about comfortably,” he added. “Major Moazzem slipped into the hole and took her into his arms and then we pulled her out.”

Another rescuer said Reshma had access to food supplies for the first fortnight of her ordeal but had run out two days ago. A government minister told reporters Reshma wept tears of joy during a brief phone conversation with Prime Minister Sheikh Hasina.

Reshma’s rescue is one of the most remarkable of recent years, although it is not the longest survival on record.

In Pakistan, on December 12, 2005, a 40-year-old woman was rescued from the ruins of her house in Kashmir, two months after a quake ravaged the region. A 27-year-old man spent 27 days buried under the rubble of an earthquake which flattened large parts of Haiti in 2010.

News of the rescue came as recovery teams were preparing to wrap up their work at the site after discovering scores more corpses in the tangle of concrete. A spokesman for the army, which is overseeing the recovery operation, said the death toll had reached 1,045, making it one of the world’s worst industrial disasters.