State lawmakers have voted to let gay couples from other states get married in Massachusetts as soon as Gov. Deval Patrick signs the bill into law.

The House voted Tuesday to repeal a 1913 law that had blocked gay marriages from out-of-state couples. On Wednesday, the bill won final approval and an emergency preamble was attached so it could take effect immediately.

Most bills must wait 90 days before becoming law. The measure has moved to the Senate for its final approval. Aides say Patrick may sign it into law as early as Thursday.

Massachusetts started allowing same-sex state residents to marry in 2004. But the 1913 law prevented marriages between people from states where such marriages were illegal.