The bill now goes to the more conservative Senate for consideration. President Mauricio Macri has said he won't veto the bill if Congress approves it, even though he opposes abortion.
"We have been able to settle our differences with respect, tolerance and listening to each other; understanding that dialogue is the road that will strengthen our future," Macri said. "My congratulations to everyone, knowing that this debate now continues in the Senate."
Though it's unclear whether the bill will become law, the issue has energized Argentine women, including thousands who filled the streets around Congress during 23 hours of tense debate.
"Legal abortion in the hospital!" they chanted upon hearing the bill was approved.
In Argentina -- a Catholic country and the homeland of Pope Francis -- abortion is illegal except in cases of rape or when the woman's life is endangered. Supporters of abortion reform say even those legal abortions are difficult to obtain. Women who otherwise get abortions can be imprisoned for as long as four years.
The Chamber of Deputies' bill also would allow women to get legal abortions after 14 weeks if the pregnancy resulted from rape, the woman's health was at risk, or the fetus suffered severe conditions not compatible with life outside of the womb.
The vote was 129 to 125. It first was reported to have passed with 131 votes, but two congressmen claimed they pushed the wrong button and voted for the bill when they meant to vote against it.
As soon as the vote was announced, thousands of pro-choice activists who had gathered to watch the vote on a giant screen outside Congress broke into cheers.
"I cried and hugged my brother," Ariadna Mina, a 15-year-old Catholic school student, said. "I really feared it was going to be rejected. I was anxious all night."
Hours earlier it seemed the bill was destined for failure, but shortly before the vote there was a last-minute shift and the measure passed by four votes.
"It was a huge surprise that it was approved, although we were optimistic I personally couldn't believe it," said Florencia Llamas, 28, a drama teacher. "Lately in this country it seems rights are always being cut, and here we have something that marks a change of era for women's rights."
While pro-choice activists continued celebrating hours after the vote, the area reserved for anti-abortion demonstrators was empty except for a few stragglers, including Liliana Fernández, a 39-year-old accountant who had tears in her eyes.
"I can't believe it, I really can't believe it," she said. "I thought our representatives would never vote in favor of death. ... Now we have to make sure senators don't follow their lead."
Almendra Pizarro, 26, a lawyer, said her joy at the decision was short-lived.
"I was ecstatic for a second but we have to be realistic," she said. "It will be tough fight in the Senate." Despite that concern, "I feel this is a great conquest, the result of a fight that has been going on for a long time."
"With the vote in Congress, Argentina can join the global trend toward expanding legal grounds to allow abortion and affirming the rights and dignity of women and girls," José Miguel Vivanco, Americas director at Human Rights Watch, said before Thursday's vote.
In Argentina, the #NiUnaMenos, or "not one less," movement thrust abortion rights fully into the public forum.
"What was once taboo only a few years ago is now being openly and thoroughly debated across society," Giselle Carino, the regional director for the International Planned Parenthood Federation/Western Hemisphere Region, said in an email interview with CNN. Carino said the trend toward legalizing abortion will continue to grow.
But physicians are often hesitant to perform an abortion, even when it's legally sanctioned, Carino said. She said the laws are usually enforced against poor women, since women of means find ways to terminate their pregnancies with misoprostol, an abortion pill, or by going to a private clinic.
Supporters of the bill emphasize that legalization would reduce the number of poor women who try to end their pregnancies through cheap, unsafe methods.
Polls have consistently shown that a majority of Argentines favor the legalization of abortion and that there is a clear generational divide.
Lucas Romero, the head of Synopsis, a consultancy, said surveys have shown the Argentine Senate would probably reject the bill.
"Of course, we can't dismiss the role of public opinion and the pressure that approval in the lower house could bring," he said. "Those could both be factors that could change the scenario in the Senate, ... but for now it remains very uncertain."
Some members of the Chamber of Deputies said the debate was agonizing. Before the vote, lawmaker José Ignacio De Mendiguren tweeted that he was a Catholic but that "I will vote in favor of the law. My convictions are my own, they guide my life. But my convictions are not the truth."
CNN's Sheena McKenzie and Nicole Chavez contributed to this report. Daniel Politi reported from Buenos Aires, and CNN's Ralph Ellis wrote and reported from Atlanta.