Same-sex unions are available in a majority of Australian states but because marriage comes under federal legislation these couples are not formally recognised as married by the government.
The new law passed by the Australian Capital Territory's 17-member Legislative Assembly in Canberra means the first weddings could take place by the end of the year, Chief Minister Katy Gallagher said.
"I am sorry that the Commonwealth threat hangs over this law, but couples who marry will do so with their eyes open to the action that the Commonwealth is taking," Gallagher said in introducing the bill.
"We understand this creates some uncertainty ahead, but that should not deter us; it does not rattle us and it doesn't change our path."
Australia has six states and two mainland territories.
The Marriage Equality Act means that gay couples from outside the small Australian Capital Territory, home to the city of Canberra and the national parliament, could travel there to be wed by an authorised celebrant.
Gallagher said the national Attorney-General George Brandis had urged her not to go ahead with the legislation as it was inconsistent with federal laws that do not permit same-sex weddings.
Brandis has vowed to challenge the move in the High Court, with the outcome potentially affecting those who used the law to wed.
Gallagher said activists had fought for the right for too long to be put off by another legal hurdle, adding that the Australian Capital Territory (ACT) was confident its law was strong.
"We are simply legislating to improve outdated, inhumane laws," she said.
Gallagher acknowledged opposition to the change, particularly from those of strong religious faith, but said the bill did not in her view challenge, diminish or undermine the religion or faith of any individual.
"If we are to be judged by a higher being on this law then let it be so," she said.
ACT opposition leader Jeremy Hanson opposed the bill which was passed with the support of Greens member Shane Rattenbury.
"We do not see the ACT Assembly as a vehicle to drive national agendas on social agendas," he said.
"We are Australia's smallest parliament in a small jurisdiction and we do not think that a majority of one person in the ACT should change the definition of marriage for a country of over 23 million people."
In April New Zealand became the first Asia-Pacific country to legalise gay marriage.