Australia will likely head to the polls on 2 July after the federal upper house voted down legislation aimed at policing construction industry unions.
The Australian Building Commission and Construction Commission (ABCC) bill was defeated by 36 votes to 34.
The Senate has voted down the ABCC bill twice, giving the government the trigger for calling an early election.
An election may benefit Prime Minister Malcolm Turnbull, who needs a clear mandate amid falling opinion polls.
Mr Turnbull used an obscure provision in the constitution to call back parliament from its recess to debate the ABCC bill this week.
The prime minister had made it clear that if senators rejected the bill a second time, he would call what is known in Australia as a double-dissolution election.
That's a mechanism in the Australian constitution that allows the government to call for an election if a piece of legislation is blocked twice in the upper house.
Election clock starts ticking
The ABCC bill aimed to re-establish a commission to oversee union activity in the building and construction industry.
The government needed support from six of eight independent and minor party senators, known as crossbenchers, for it to pass.
Debate over the bill had been expected to last several days, but senators quickly firmed up their positions and the bill was voted down on Monday night.
Now that Mr Turnbull has his trigger, he is expected to call an election after the government hands down its budget on 3 May.
Election rules would require Mr Turnbull to hold the election well before 2 July should he dissolve parliament immediately.
Changes to voting rules that will disadvantage so-called micro-party senators do not come into effect until 1 July.
In a double-dissolution election all Senate seats are up for grabs and clearing out senators hostile to the government is widely seen as a key Turnbull objective.
Mr Turnbull must call the election before 11 May or he will no longer be able to use the double dissolution trigger.
'Thuggery or fairness'
The government has painted the labour bill as essential to the economy, saying a high rate of industrial disputes and "standover tactics" were acting as a drag on an important sector.
Employment Minister Michaelia Cash, speaking during the Senate debate, said the parliament could "choose if it stands for thuggery or fairness".
But the opposition and crossbench senators said the government had no intention of seeing the bill pass as it sought to attain a double dissolution trigger.
Crossbench senator Jacqui Lambie told the ABC that the ABCC bill was "absolutely not" an appropriate trigger for a double dissolution.
She said the government had not been committed to negotiating amendments to the legislation with crossbenchers.
"If you go out there, you will find most people when you mention those four letters - ABCC - they look at you with a blank look on their face and say 'hey, what are you talking about?' People out there are much more concerned about education and health," she said.
The militant Construction Forestry Mining and Energy Union (CFMEU), the chief target of the ABCC bill, called its defeat a "win for human rights and freedoms".
Rough and tumble
The vote caps off an extraordinary day in Australia's parliament that began with Governor General Peter Cosgrove addressing the Senate about the recall of parliament at the prime minister's behest.
Labor Senator Stephen Conroy accused Mr Cosgrove of demeaning his office by calling back parliament to debate the bills.
Senator Conroy said the decision to recall both houses of parliament was a "tawdry political stunt".
Opposition leader Bill Shorten rebuked Senator Conroy over the comments, saying he should "confine his remarks to the government".
Meanwhile the government was in full election mode as it announced that 12 offshore patrol vessels would be constructed in Adelaide, saving 1,000 jobs.