The incident took place in the Pasarlapudi village under Amalapuram mandal of East Godavari district on Thursday evening.
"The baby is now recovering and her health condition is satisfactory," said Prabhakar Deepak Chakravarthy, the doctor who led the medical team that performed the surgery at a private hospital in Amalapuram.
The girl swallowed the mobile earphone while playing with it at her home. Her constant cries attracted the attention of her parents who could not fathom the reason for her condition.
They brought the baby to the hospital, where doctors initially did not find anything wrong with her health, Dr Chakravarthy said.
However, an X-ray revealed an article stuck in her body which was later identified as a mobile earphone, he said.
A team of doctors performed the surgery and safely removed the earphone, Dr Chakravarthy added.