Democrats hoping to regain Congress got a big boost Tuesday night as primary results from several key states, especially New Jersey and California, increased the party’s chances for a blue wave in November.

California was a particular worry for Democrats due to the state’s unusual ranked voting system. The top two vote getters, regardless of party, advance to the general election.

Democrats had a plethora of candidates jockeying for positions in key races, racing the specter that they would cancel one another out and pave the way for two Republicans to emerge as the winners. The party seems to have avoided that problem, largely by pouring millions of dollars into the primaries.

Pending the final tally, Democrats will now have candidates on the ballot for seven Congressional seats currently held by Republicans. The incumbent targets include Dana Rohrabacher, who recently said homeowners should have the right not to sell to gays, as well as several open seats vacated by retiring Congressmen.

The state’s overwhelmingly blue lean will also help Gavin Newsom in his bid to become Califoria’s governor. Newsom, the former mayor of San Francisco who directed the city to allow same-sex marriage in 2004, will be facing off against Republican John Cox, who in the past has compared homosexuality to bestiality. (He now says his views have changed.)

Meanwhile, at the local level, LGBTQ candidates advanced in several key races. Mark Leno held a narrow lead in his bid to become the first openly gay mayor of San Francisco.

San Francisco being San Francisco, the city has an even more byzantine voting system than the state. Voters actually rank their top three candidates, and the combined results are then weighted together.

Leno used the ranked system to his benefit. He actually failed as the top choice among voters. But voters saw him as an acceptable second or third choice. Prior to the election, Leno actually teamed up with rival Jane Kim, with the pair urging their supporters to make sure that whoever voters’ first choice was, one of them should be the voters’ second choice.

LGBTQ candidates succeeded in other races as well.

Democrat Ricardo Lara will be facing Steve Poizner, a Republican turned independent, to become California’s Insurance Commissioner. Lara would be the first openly gay statewide official in California history.

Democrat Neil Rafferty, a former Marine, will face a runoff election in his bid for an Alabama state representative seat. Rafferty, who is gay, is seeking to replace out lesbian Patricia Todd, who retired.

In Iowa, Zach Wahls won the Democratic nomination for a state senate seat. Wahls, 26, was raised by two lesbian mothers and co-founded Scouts for Equality, a group that advocated for the end of the Boy Scouts of America’s ban on gay scouts and leaders.