Legislators pressured by LGBT groups as well as by church organizations opposed to the move on Friday approved most of a government-sponsored bill that recognizes same-sex marriages and gives couples many of the tax, insurance and child custody benefits available to male-female married couples.
That makes Taiwan the first place in Asia with a comprehensive law both allowing and laying out the terms of same-sex marriage.
Taiwanese President Tsai Ing-wen, a supporter of the law, tweeted: "On May 17th, 2019 in Taiwan, LoveWon. We took a big step toward true equality, and made Taiwan a better country."
"It's a breakthrough, I have to say so," said Shiau Hong-chi, professor of gender studies and communications management at Shih-Hsin University in Taiwan.
Thousands of people, including same-sex couples, demonstrated Friday morning in the rainy streets outside parliament before the vote. Many carried rainbow-colored placards reading "The vote cannot fail." About 50 opponents sat under a tent outside parliament and gave speeches favoring marriage between only men and women.
Taiwan's Constitutional Court in May 2017 said the constitution allows same-sex marriages and gave parliament two years to adjust laws accordingly. The court order mobilized LGBT advocacy groups pushing for fair treatment, as well as opponents among church groups and advocates of traditional Chinese family values that stress the importance of marriage and producing offspring.
Religion, conservative values and political systems that discourage LGBT activism have slowed momentum toward same-sex marriage in many Asian countries from Japan through much of Southeast Asia, although Thailand is exploring the legalization of same-sex civil partnerships.
"This will help spark a debate in Thailand, and hopefully will help Thailand move faster on our own partnership bill," said Wattana Keiangpa of the Asia Pacific Coalition on Male Sexual Health.
Phil Robertson, deputy Asia director for Human Rights Watch, said Taiwan's action should "sound a clarion call, kicking off a larger movement across Asia to ensure equality for LGBT people and pro-active protection of their rights by governments throughout the region. No more excuses!"
At least 20 same-sex couples are planning a mass marriage registration in Taipei on May 24, a spokesman for the advocacy group Marriage Equality Coalition Taiwan said. The newlyweds and hundreds of invitees will hold a mass party a day later on a blocked-off boulevard outside the presidential office, the event organizer said.
The law will give a boost to Jay Lin and his partner, who hope to marry and assume joint custody of their two 2-year-old sons. They plan to register after May 24.
"A lot of gay parents are excited about that already," said Lin, a Taipei-based online streaming service founder.
"I think once more people are married and more families are more comfortable being out in public, that will naturally have a beneficial impact on society and on people's minds," Lin said.
Taiwan's acceptance of gay and lesbian relationships began in the 1990s when leaders in today's ruling Democratic Progressive Party championed the cause to help Taiwan stand out in Asia as an open society.
Although claimed by China as its own territory, Taiwan is a self-governing democracy with a vibrant civil society dedicated to promoting rights for sexual and ethnic minorities, women, the handicapped and others.
Mainland China, ruled by the authoritarian Communist Party, remains much more conservative and officials have repeatedly discouraged even the discussion of legalizing same-sex marriage.
Despite that, news of Taiwan's new law was a major trending topic on social media in China, with more than 100 million views on the Twitter-like microblogging site Weibo.
Opponents in Taiwan raised fears of incest, insurance scams and children confused by having two mothers or two fathers. Both sides of the issue have held colorful street demonstrations and lobbied lawmakers.
"This is going to cause a lot of morality problems," said Lin Shih-min with the Taiwan political action group Stability of Power, which opposed the law. "From the point of view of the children, they have the right to grow up with both a mother and a father."
In November 2018, a majority of Taiwan voters rejected same-sex marriage in an advisory referendum. However, legislators favoring the bill, and voting separately on each item largely along party lines, said it followed the law as well as the spirit of the referendum.
"We need to take responsibility for the referendum last year and we need to take responsibility for people who have suffered from incomplete laws or faced discrimination," ruling party legislator Hsiao Bi-khim said during the three-hour parliament session.