The Greens and the Palmer United Party are each set to win a Senate seat as voters punished the major parties in a rerun Western Australian ballot that will determine the makeup of the upper house and its decisions on the Abbott government’s legislative agenda.

The result means the Coalition will be forced to get the votes of the PUP Senate bloc, as well as either two or three other crossbench senators, for every bill opposed by Labor and the Greens.

After a strong grassroots campaign the Greens won a 6.3% swing, easily securing a quota for Senator Scott Ludlam. With an advertising campaign that outspent all the other parties combined, the Palmer United Party also secured a 7.4% swing, putting lead candidate Dio Wang very close to a quota and certain to be elected.

With almost 90% of first preference votes counted, Labor suffered a 4.8% swing against it. Labor’s controversial lead candidate, Joe Bullock, has been elected, but its second candidate, Louise Pratt, is fighting for the sixth WA senate spot with the Liberals third candidate, Linda Reynolds.

There was also a swing of 5.5% against the Liberals. The Liberals had been confident of securing three seats, although the deputy leader, Julie Bishop, insisted the swing was well within normal swings against a government in a by-election.

While it is clear that two Liberals, one Labor, one Green and one PUP senator have been elected, the final seat is difficult to predict and will be determined by the complicated process of distributing preferences as minor parties are eliminated.

WA’s almost 1.5 million voters were forced back to the polls after last September’s Senate ballot in the state was declared invalid when 1,370 votes were lost. The rerun ballot had a low turnout, which disadvantaged the major parties.

Both major parties framed the poll rerun as a referendum on the first seven months of the Coalition government - Tony Abbott saying it gave WA voters a chance to make sure the carbon and mining tax were repealed and Bill Shorten urging a vote against looming budget cuts.

But Labor’s campaign suffered a disastrous late set-back with the publication of a speech to a Christian organisation by the party’s lead candidate, rightwing unionist Joe Bullock, in which he described some ALP members as “mad” and said working class voters were right not to trust the Labor. Bullock was forced to send an election eve apology via email to Labor members, and told the ABC on election night that he had not known the question and answer session after the speech last November was going to be posted on the internet.

Asked about the controversy surrounding Bullock on Saturday night, former Labor minister Chris Evans said there was “no question Labor has a serious problem with its pre-selection processes” and that it was “not necessarily producing the best candidates”.

The Palmer United party promised things the party almost certainly cannot deliver – in particular a greater share of goods and services tax revenue. Its lead candidate, Dio Wang, took a low profile during the campaign with his employer and party leader, Clive Palmer, doing almost all the talking for the party.

Already in the Senate that will sit from July are the two PUP senators-elect – former rugby league player Glenn “the brick with eyes” Lazarus, and Tasmanian Jacqui Lambie. They will be joined by the “motoring enthusiast” Ricky Muir, whoafter the election entered a still-unclarified voting “alliance” with Palmer. Also elected is the pro-gun, pro-free market Liberal Democrat David Leyonhjelm and the Family First party’s Bob Day, who join sitting senators independent Nick Xenophon and the Victorian DLP senator John Madigan on the crossbench.

If Labor secures the final spot the Coalition will have the extremely tough task of securing seven out of eight crossbench votes to secure the requisite 39 votes to pass legislation opposed by Labor and the greens. Labor and the greens would need to find two of the crossbench to block a bill.

This scenario could mean, for example, that Xenophon and Madigan could join Labor and the Greens to achieve the necessary 38 votes to block the abolition of the Clean Energy Finance Corporation.

If the Coalition secures the final spot it will need six out of eight crossbench votes to pass legislation opposed by Labor and Labor and the Greens would need to find three crossbenchers to block a bill.