DHAKA, — In a startling development, a woman trapped for 17 days beneath the rubble of a collapsed building on the outskirts of Dhaka was discovered alive Friday, and was rushed to a nearby military hospital after rescuers pulled her free.

The woman, whose name is Reshma, apparently had been in the basement of the building, possibly in a Muslim prayer room. Rescuers, speaking live on national television from the wreckage site, said they were clearing debris Friday afternoon when they saw a pipe moving. It turned out to be Reshma, shaking the pipe from below, trying to gain attention.

“Save me!” rescuers heard her shouting.

The stunning discovery transformed what had been an especially gloomy day in the recovery effort, as the death toll pushed past 1,000 victims. More than 3,000 people were believed to be working at five clothing factories in the building, Rana Plaza, when it collapsed on the morning of April 24 in what is now considered the worst disaster in the history of the garment industry.

Reshma’s rescue was broadcast on television across Bangladesh. She was wearing a purple and red salwar kameez as she was removed from the rubble. One of the rescuers, a soldier with the Bangladeshi army, told television crews that Reshma had discovered food and water that had lasted until two days ago.

Another rescuer, Lt. Col. Moazzem, told Bangladesh’s state news agency that he and another soldier discovered Reshma after cutting a hole to the basement.

“I told her, ‘Mother, don’t be afraid, we are here to rescue you,’” said Moazzem, according to the agency. “Would you like a drink of water?” He said Reshma was given saline and biscuits before rescuers removed her from the wreckage.

Ali Ahmed Khan, director general of the Bangladesh Fire Service, said Reshma was apparently inside a Muslim prayer room, which had oxygen and enough clear space for her to stand up.

Prime Minister Sheikh Hasina was rushing to the military hospital where Reshma is being treated.

Days earlier, rescuers had given up any hope of finding more survivors and had started using heavy machinery to more quickly clear debris from the site. Before Friday, the last survivor was thought to have been a woman named Shaheena; rescuers spent more than 20 hours on April 28 trying to save Shaheena before a fire broke out, killing her.

The authorities have said more than 2,000 people were rescued or escaped on their own.

Khan, the fire service director general, said work crews would “for the time being” suspend the use of heavy machinery and resume rescue searches in the remaining rubble.

“We are very delighted,” said Khan, noting that rescuers had taken pains to work carefully in case someone was still alive. “The army and fire service has been working very, very cautiously.”

The rescue brought to mind a similar scene from Haiti in 2010 when a 16-year-old girl was plucked from beneath the rubble of a collapsed house 15 days after a deadly earthquake struck outside Port-au-Prince.

A Haitian man, who was buried in the rubble of a market with some food and fruit, was found 27 days after the quake.