With about half the expected ballots counted, Referendum 74 was passing with 52 percent of the vote.
The measure asked Washingtonians to approve or reject a state law legalizing same-sex marriage that lawmakers passed earlier this year. That law was signed by Gov. Chris Gregoire but has been on hold pending the election's outcome.
"I think it's premature to declare victory, but we're in a very strong position," said Zach Silk, a spokesman for Washington United for Marriage, which supports gay marriage.
Other supporters were even more optimistic, cheering and hugging in response to the results at election watch parties in the state. In Seattle's Capitol Hill neighborhood, the police closed off several blocks for an outdoor election celebration, where more than 1,000 people were dancing and chanting "74, 74, 74."
The measure was losing in 31 of the state's 39 counties. But it had its strongest lead - 65 percent of the vote - in King County, the state's largest county and home to Seattle.
About $13.6 million has been spent on the campaign, with the bulk of it coming from gay marriage supporters. Washington United for Marriage far outraised its opponents, bringing in more than $12 million compared with the $2.7 million raised by Preserve Marriage Washington, which opposes the law.
"We remain cautiously optimistic that when all the ballots are in that the voters of Washington will not redefine marriage," said Chip White, a Preserve Marriage spokesman. "We don't need to win King County to win the state. There's still a path to victory for us."
Maine and Maryland on Tuesday night became the first states to approve same-sex marriage by popular vote. They join six other states - New York, Connecticut, Iowa, Massachusetts, New Hampshire, Vermont - and the District of Columbia in allowing gay marriage.
Maine's measure passed with 54 percent of the vote, while the measure in Maryland matched Washington state's lead of 52-48 percent. In Minnesota, voters rejected a proposed constitutional amendment to ban gay marriage in their state. Gay marriage remains illegal under Minnesota state law.
In Washington, preliminary results from exit polling data showed there were political and religious divides among voters over the measure - with just one in five Republicans backing it, compared with more than eight in 10 Democrats and a majority of independents.
Those who attend weekly church services were more strongly opposed to gay marriage. Just one-quarter of weekly churchgoers backed the legalization of same-sex marriage, while four out of five voters who never attend church favored it. A majority of married women supported R-74, but married men broke against it.
Voters in Eastern Washington tied on the issue.
The survey of Washington voters was conducted for The Associated Press and television networks by Edison Research. It included preliminary results from a survey of 1,493 voters who voted early or absentee and were interviewed by landline or cellular telephone from Oct. 29 through Nov. 4. Results for the full sample were subject to sampling error of plus or minus 3 percentage points; it is higher for subgroups.
The road to gay marriage in Washington state began several years ago.
A year after the state's gay marriage ban was upheld by the state Supreme Court, the state's first domestic partnership law passed in 2007, granting couples about two dozen rights, including hospital visitation and inheritance rights when there is no will. It was expanded a year later, and then again in 2009, when lawmakers completed the package with the so-called "everything but marriage" bill that was ultimately upheld by voters later that same year.
This year, lawmakers passed the law allowing gay marriage, and Gregoire signed it in February. Preserve Marriage gathered enough signatures for a referendum, and the law never took effect, instead remaining on hold pending the election.
If voters uphold the law, gay couples could start picking up their marriage certificates and licenses from county auditor offices Dec. 6, a day after the election is certified. However, because Washington state has a three-day waiting period, the earliest the certificate could be signed, making the marriage valid, is Dec. 9.
The law doesn't require religious organizations or churches to perform marriages, and doesn't subject churches to penalties if they don't marry gay or lesbian couples.
The outcomes of the measures in Maine and Maryland broke a 32-state streak that dated back to 1998 in which gay marriage had been rejected by every state that voted on it. The other states that allow gay marriage either enacted laws or issued court rulings permitting it.