After a marathon debate, 38 senators voted against it and 31 in favour. Its defeat means lawmakers must wait until next year to resubmit legislation.
Currently abortion is allowed in Argentina only in cases of rape, or if the mother’s health is in danger.
Demonstrators on both sides of the debate rallied outside parliament as voting took place.
Anti-abortion activists have been jubilant. “What this vote showed is that Argentina is still a country that represents family values,” one told the Reuters news agency.
Pro-choice campaigners say they are not giving up. Some started fires and lobbed missiles at police after the vote.
How did we get here?
Pro-choice campaigners have for years tried to get bills passed in Argentina, where the population is overwhelmingly Roman Catholic.
Their efforts gained new impetus when President Mauricio Macri – who opposes abortion – called on Congress to consider a vote on it, and it narrowly passed in the lower house.
For the bill’s advocates, legalising abortion is a matter of public health, with 43 women thought to have died last year after receiving abortions.
The debate in the Senate lasted more than 16 hours.
Former President Cristina Fernández de Kirchner, who is now a senator and who had refused to back abortion while president, supported the bill, saying her mind was changed by the thousands who took to the streets.
There are 42 men in the Argentine senate and 30 women. Among the women the vote was evenly split while a majority of men voted against.
Uruguay and Cuba are the only Latin American nations to have fully decriminalised abortion.
Campaigners in their own words
“This law doesn’t obligate, nor does it recommend anyone have an abortion. The only thing this law does is defend the right to choose.” Norma Durango, from the opposition Peronist party
“The message that we wanted to put across is that abortion equals social failure. For a woman to resort to it, many other things need to have failed first.” Camila Duro of the anti-abortion non-governmental organisation Frente Joven
“Women perform abortions with criminalisation or without it.” Sabrina Cartabia Groba, pro-choice lawyer and campaigner
“Abortion always kills a child and it doesn’t solve the woman’s problem. We believe that this is never the solution. Faced with an unexpected pregnancy abortion is never the solution. There are always other solutions.” Maria Castillo, who campaigned outside parliament