MPs have backed amendments which require the government to liberalise abortion and extend same-sex marriage to Northern Ireland if devolution is not restored.
It was part of a Commons debate aimed at keeping NI running in the absence of devolved government.
Its main purpose was to extend the government's legal power to delay a fresh Stormont election.
MPs had tabled a series of other amendments.
They argued those issues should not be stalled due to the lack of devolution, which collapsed in January 2017.
MPs backed the same-sex marriage amendment by 383 votes to 73, while the abortion amendment was backed 332 to 99.
Neither amendment automatically changes the law in Northern Ireland, where same-sex marriage is not legal and abortion is only allowed in very limited circumstances.
Labour's Conor McGinn, originally from County Armagh, put forward a proposal to the NI Executive Formation Bill that if Stormont is not restored by 21 October, then the government should legislate for same-sex marriage - on the condition that a future assembly could overturn or amend the law.
The abortion amendment, put forward by his Labour colleague Stella Creasy, is subject to the same condition.
The two contenders vying to become the next prime minister were asked about Tuesday's vote during a leadership debate on ITV.
Jeremy Hunt said he would support the move, while Boris Johnson said it should remain a devolved issue.
"I think it's a matter for the people of Northern Ireland and one of the most important reasons for getting the Stormont government back up and running," Mr Johnson said.
Analysis: Crucial caveat to law change
By Jayne McCormack, BBC News NI Political Reporter
Campaigners for same-sex marriage in Northern Ireland say this is a watershed moment.
Others may see it as the biggest step yet by Westminster towards enacting direct rule.
But it does not automatically change the law - the caveat is that it can only happen if Stormont hasn't been restored by 21 October.
The Northern Ireland Office minister, John Penrose, also said even if we get to that stage, time constraints mean they may be unlikely to be able to implement the law change right away.
The DUP was angry that Parliament was voting on issues it deems devolved matters, saying the bill had been "hijacked".
But the MP behind the amendment - Conor McGinn - said the DUP should see it as an "incentive" to get Stormont restored so it never has to come into effect.
"My priority, and what I want to see, is an assembly up and running and functioning in Stormont, so it is my strong view that the way that this amendment is crafted doesn't impinge on the devolved settlement because it explicitly recognises that this is a devolved power," Mr McGinn said.
"At the minute, the assembly and executive exists in the ether or as a concept, not in reality."
Read more from Jayne here.
What happens now?
If the Stormont assembly has not been restored by 21 October, the government must bring regulations to Parliament to amend the law in Northern Ireland on same-sex marriage.
There would not have to be a further vote on the matter, as it would come in the form of secondary legislation - statutory instruments - which would not be put to a vote on the Commons floor.
The bill still has to go to the House of Lords for approval, but it is very unlikely it will be overturned there.
Former Number 10 Director of Legislative Affairs Nikki Da Costa told BBC News NI MPs could ask for a resolution to overturn it - but given the majority in favour of the amendment, that seemed unlikely to happen too.
The DUP voted against both amendments, but two of its MPs, Gavin Robinson and Sir Jeffrey Donaldson, were tellers, meaning they did not vote.
Independent unionist MP for North Down, Lady Hermon, backed the same-sex marriage amendment, as did Northern Ireland Office Minister John Penrose.
Northern Ireland Secretary Karen Bradley and the prime minister abstained.
Another hour of debate on other amendments, with some tabled by the DUP looking at the implementation of the Military Covenant in NI, also took place.
MPs also backed an amendment tabled by Conservative MP Dominic Grieve, which requires the government to submit regular progress reports to Parliament, giving updates on the talks process at Stormont.
It passed by just one vote.
The DUP reacted angrily to the decision to allow the abortion and same-sex marriage amendments to be debated in Parliament.
Speaking before the same-sex marriage amendment was approved, the party's Westminster leader, Nigel Dodds, said if approved by MPs, the amendment would "drive a coach and horses through the principle of devolution".
'Fundamentally wrong approach'
During the debate, he said there were many issues - such as the health service, education, infrastructure investment, jobs - that were having "massive detrimental effects by not having progress made through legislation and executive decisions.
"Yet nobody is addressing that point today, instead we're picking out certain issues, which I think is a fundamentally wrong approach especially when talks are under way currently."
Party colleague Gavin Robinson said that if the assembly was restored tomorrow, the issue of same-sex marriage could be legislated on as the DUP does not have the numbers to stop it.
He said the party stopping this happening was Sinn Féin.
However, Sinn Féin MP Elisha McCallion said: "It was inevitable that the British government's failure to defend basic rights available everywhere else on these islands would be confronted.
"This was the message coming out of Westminster today."
John O'Doherty of the Rainbow Project, said: "Parliament has always had the power to legislate for marriage equality in Northern Ireland and we are glad the House of Commons has seen sense and voted to give people in Northern Ireland the same freedoms enjoyed by everyone else in these islands."
Conservative MPs and Labour MPs were given free vote on the issue.
The Scottish National Party (SNP), which has traditionally abstained on devolved matters in other nations, said on Tuesday morning that its MPs would be given a free vote on the issue and 25 of its MPs backed it.
Timeline of same-sex marriage:
- England and Wales legalised same-sex marriage in July 2013 and came into force in March 2014
- Scotland legislated for same-sex marriage in February 2014 which came into effect in December that year
- The Republic of Ireland legalised same-sex marriage in a referendum in May 2015 - becoming the only country in the world to do so by popular vote. Ireland's first same-sex marriage took place in November 2015.
Northern Ireland has been without a government for more than two and a half years, after a bitter row over a financial scandal split the DUP and Sinn Féin.
The Northern Ireland secretary has twice pushed back her obligation to call an election at Stormont, with it due to end on 25 August.
This new legislation would delay another poll until 21 October, with another possible extension to 13 January 2020.
It also provides greater clarity about decision-making to civil servants at Stormont, in the absence of functioning ministers.