Juana Rivas accuses her ex-partner of domestic violence and refuses to let him see their boys, aged 11 and three.
She had been on the run since rejecting an order to hand her sons over to her Italian ex-partner, Francesco Arcuri, in July.
Rivas gave herself up at a court in the southern city of Granada on Tuesday, her legal adviser Francisca Granados told reporters.
She has since been released and a judge allowed the children to remain in Rivas's custody pending her appeal of the order to turn the boys over to Arcuri.
READ MORE: Plight of mother-of-two abuse victim divides Spain
Dozens gathered outside to support Rivas but opinion on social media was deeply divided.
Her return was the top trending topic on Twitter, even as four surviving suspects of an alleged terror cell that unleashed carnage last week in Catalonia faced charges in court.
“What court forces a mother to hand her children to an abuser? We should think about this,” wrote one Twitter user, Ana Garcia @angarfi68.
Que justicia obliga a una madre a entregar a sus hijos a un maltratador? Debemos pensar en ello.
— ana (@angarfi68) July 28, 2017
Others said she should be jailed for ignoring a court order. “Is Juana Rivas in jail yet?” wrote another Twitter user Carlos Mas @carlos_fer_mas.
Está ya Juana Rivas en la carcel? #JuanaRivas
— Carlos Más (@carlos_fer_mas) August 22, 2017
According to the Maracena municipal women's centre which is representing her, Rivas suffered “psychological and physical violence” at the hands of her ex-partner who was found guilty of abusing her in 2009.
He filed a complaint for child abduction after she took their sons away in May 2016.
A Spanish court ruled the children should return to live with their father in Italy, arguing among other things that the eldest boy was evaluated by psychologists and was all right with seeing his father.
Rivas told media after her release: “I don't want to be a fugitive, I came to explain my situation and ask for help.”
In an interview with Italy's Ansa news agency, Arcuri denied any violence. “I want to be able to hold my children again in my arms, I haven't seen them since last year,” he said.