The Morrison government's union-busting legislation has been defeated in the Senate after One Nation spectacularly opposed it at the final vote.

The "ensuring integrity" bill, which would have made it easier to deregister unions and ban officials, was expected to pass on Thursday with Pauline Hanson's support.

AAP

One Nation's two senators sided with Labor, the Greens and Jacqui Lambie to tie a vote 34-all - meaning the bill failed - in a major shock on the floor of the upper house.

Labor and Greens senators clapped and cheered after the result, following a week of speculation the government had the numbers.

Opposition Leader Anthony Albanese celebrated the surprise victory for the union movement.

"This is a win for the working people of Australia - the very people this bill was designed to hurt," he tweeted after the bill was voted down.

BREAKING: The Senate just voted down the Liberals’ disgraceful union-bashing legislation.



This is a win for the working people of Australia – the very people this bill was designed to hurt. — Anthony Albanese (@AlboMP) November 28, 2019

"Thank you to everyone who spoke out, stood up and fought back. This win belongs to you," he later tweeted.

Secretary of the Australian Council of Trade Unions Sally McManus reacted by thanking "every person who stood up and said no to union-bashing".

We defeated the Ensuring Integrity Bill. Thank you to every person who stood up and said no to union bashing #auspol — Sally McManus (@sallymcmanus) November 28, 2019

Industrial Relations Minister Christian Porter said he was "disappointed".

"It's for Pauline Hanson to explain why she voted against a bill that met every requirement she sought through extensive consultation," he said in a statement.

He said it was important reform and the government would seek to reintroduce the bill "at an appropriate time".