More than 62% voted in favour of amending the country's constitution to allow gay and lesbian couples to marry.
It is the first country in the world to legalise same-sex marriage through a popular vote.
Irish Prime Minister Enda Kenny said it was a "small country with a big message for equality" around the world.
The referendum was held 22 years after homosexual acts were decriminalised in the Republic of Ireland.
Same-sex marriage is now legal in 20 countries worldwide.
BBC Ireland correspondent Chris Buckler said the atmosphere at Dublin Castle, where thousands of people gathered to watch the results being announced, was more like a festival than a referendum result.
Counting began at 09:00 BST on Saturday, and the final result was declared shortly before 19:00 BST.
Cheers and applause greeted the announcement of the results by the returning officer RÃ­ona NÃ­ Fhlanghaile.
The turnout was more than 60%, and the outcome seemed clear a short time into the count, with prominent "no" campaigners declaring defeat early on.
The Republic of Ireland has a written constitution which can only be changed by referendum.
Now that the proposal has been passed, a marriage between two people of the same sex will have the same status under the Irish constitution as a marriage between a man and a woman.
They will be recognised as a family and be entitled to the constitutional protection for families.
Civil partnerships for same-sex couples have been legal in Ireland since 2010, giving couples legal protection which could be changed by the government.
However, married gay people will now have a constitutional standing that can only be removed by another popular vote.
Reaction to 'yes' vote
In total, 1,201,607 people voted in favour of same-sex marriage, while 734,300 voted against.
Out of 43 constituencies, only the largely rural Roscommon-South Leitrim had a majority of "no" votes.
Many people returned to the Republic of Ireland from abroad to cast their votes.
Minister for Health Leo Varadkar, who earlier this year came out as the Republic of Ireland's first openly gay minister, said the vote showed that the "traditional cultural divide" between rural and urban areas had vanished.
"This is really Ireland speaking with one voice in favour of equality," he told Irish broadcaster RTE.
Catholic Archbishop of Dublin, Diarmuid Martin, said if the referendum was an affirmation of the views of young people, the church had a "huge task in front of it".
"I think really the church needs to do a reality check," he told RTE.
"I appreciate how gay and lesbian men and women feel on this day, that they feel this is something that is enriching the way they live. I think it is a social revolution."
Voters were asked whether they agreed with the statement: "Marriage may be contracted in accordance with law by two persons without distinction as to their sex."
In 2010, the Irish government enacted civil partnership legislation, which provided legal recognition for gay couples.
But there are some important differences between civil partnership and marriage, the critical one being that marriage is protected in the constitution while civil partnership is not.
Catholic churches will continue to decide for themselves whether to solemnise a marriage.
The leader of the Catholic Church in Ireland, Eamon Martin, has said the church may look at whether it continues to perform the civil side of solemnisation if the change comes in.
A separate referendum, on whether the eligibility age of presidential candidates should be lowered from 35 to 21, was held at the same time.
The referendum was defeated with 73.1% voting no and 26.9% voting yes.
A total of 1,412,602 people voted against, while 520,898 people voted in favour.
The Republic of Ireland has voted overwhelmingly to legalise same-sex marriage in a historic referendum.