Pennsylvania was the last remaining state to outlaw gay marriage in the Northeast, a region that tends to be socially liberal and Democratic.
An appeal to the US Circuit Court of Appeals is likely. If the decision stands, Pennsylvania would become the 19th state to legalize gay marriage.
State marriage bans have been falling around the US, including in several socially conservative states, since the Supreme Court last year struck down part of the federal Defense of Marriage Act in a landmark ruling.
Oregon became the 18th state on Monday, when jubilant couples began applying for marriage licenses immediately after a federal judge issued a ruling that invalidated that state's voter-approved same-sex marriage ban.
The issue of state marriage bans is ultimately expected to be decided by the Supreme Court.
In Pennsylvania, US District Judge John Jones decision on Tuesday was a victory for 11 couples, a widow and one of the couples' two teenage daughters who filed the first challenge to the law.
Tom Corbett's office had defended the law after the state's attorney general called it unconstitutional and refused to defend it.
"We are a better people than what these laws represent, and it is time to discard them into the ash heap of history," Jones wrote of the 1996 state ban.
The plaintiffs said the ban deprives them of the legal and tax benefits enjoyed by married couples. One of the plaintiffs, Maureen Hennessey, married her longtime companion, Mary Beth McIntyre, out of state in 2011. McIntyre died in May after battling cancer.
The Pennsylvania lawsuit, filed July 9, was the first known challenge to the state law that effectively bans same-sex marriage and the recognition of gay marriages from other states.
At least five later challenges have surfaced in state and federal courts since the lawsuit was filed, including one in which a county official is defending his decision to issue 174 marriage licenses to same-sex couples.


Latest News from World News Desk