The National Disaster Response Force (NDRF), police and the administration had launched a massive operation to save the boy.
The boy, identified as Chandrasekhar, was playing near a cattle shed at Ummadivaram village when he accidentally fell into borewell at around three this afternoon, police said.
His mother, who was tending cattle nearby, did not notice that the boy was playing precariously close to the defunct borewell which had been left uncovered.
The boy was found trapped over 15 feet down in the borewell shaft, a police official told PTI over phone.
A crater was dug parallel to the borewell to rescue the boy, while oxygen tubes had been lowered inside.
District Collector Kona Sasidhar had also rushed to the village to oversee the rescue operation.
Andhra Pradesh Deputy Chief Minister N China Rajappa spoke to the district authorities and had asked them to spare no effort to rescue the trapped child, officials said.
Health minister Kamineni Srinivas also spoke to the district medical and health officer, following which a medical team was rushed to the spot.
with inputs from PTI