Face of Nation : It was part of a Commons debate aimed at keeping NI running in the absence of devolved government.
Its main purpose is to extend the government’s legal power to delay a fresh Stormont election.
MPs have tabled a series of other amendments.
They argue these 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 – with the caveat 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 caveat.
There was a very clear caveat in Conor McGinn’s amendment that it could only go forward if an executive cannot be restored by 21 October.
That would put it back into the hands of the government, so this is far from clear cut.
It is quite vague and has a lot of detail missing from it.
Northern Ireland Office Minister John Penrose said even if we get to a stage in October and the executive is not restored, he is not clear how and when the government would be able to legislate.
“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.”
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, is scheduled for later, with voting on these expected at about 19:00.
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”.
North Antrim MP Ian Paisley said it would be unhelpful to the talks process at Stormont.
However, Mr McGinn rejected that and said his amendment should be viewed as an “incentive” to restore the assembly, so that it could take legislative control back over the issue.