The government has suffered a “humiliating” defeat on the floor of parliament after Labor successfully overruled the Coalition and elevated renegade Nationals MP Llew O’Brien as deputy Speaker.

O’Brien, who quit the Nationals’ partyroom on Monday morning after a clash with leader Michael McCormack, accepted Labor’s nomination for deputy Speaker in an attempt to deny the government’s endorsed candidate, the Victorian MP Damian Drum.

In a secret ballot of MPs in the House of Representatives, Nationals MPs defected to join Labor and crossbench MPs to support O’Brien. The Queensland MP won by 75 votes to 67.

The shock vote will pile further pressure on McCormack, who survived a leadership challenge from the former deputy prime minister, Barnaby Joyce, last week, but who continues to face internal criticism, particularly among Queensland MPs.

O’Brien, who moved the spill motion against McCormack, said it was an “honour” to accept the position that comes with a 20% pay rise – the equivalent of $42,000.

“It is a tremendous privilege to be in this place,” the member for the safe LNP seat of Wide Bay said. “Every election we put ourselves forward to our constituents to serve them in the most honest and best way that we can.

“I am privileged to be here. As a country policeman, I find it incredible that I can walk into this place and take part in this.”

The Speaker, Tony Smith, said he needed to check the standing orders to ensure that O’Brien’s decision to quit the National party did not affect his eligibility for the role, but O’Brien clarified that he remained a “loyal and faithful” government member.

“I have clearly stated that I am still a member of the government – I do not sit in the Nationals partyroom, I sit as a member of the LNP, which was what was on my ballot paper when I put myself before the people of Wide Bay.”

Despite the turmoil, the prime minister, Scott Morrison, attempted to spin the result as a positive, saying the House had to choose between two experienced government members.

“There is no shortage of government members in this House to ensure that we continue to deliver on the promises that we made to the Australian people … and these government members will continue to ensure that a strong economy, a safer Australia, and a government that will continue to meet the needs of the Australian people will be delivered on each and every day that this government majority continues to serve in the house,” he said.

The Labor leader, Anthony Albanese, congratulated O’Brien for “receiving such strong support from his colleagues” in Parliament.

“No amount of marketing or spin can hide the humiliation for the government from that vote,” he said.

“We have just seen the stability of the Coalition on full view, for all to see – government members running against each other for a position of deputy Speaker … and for the prime minister to stand up and to pretend somehow this is a win.

“I congratulate the prime minister on his capacity to make anything into a marketing proposal.”

In response to the vote, McCormack said O’Brien would do “a good job”.

“That’s democracy,” he said.

The Nationals deputy whip, Ken O’Dowd, told the ABC he was one of O’Brien’s colleagues who had voted to support his fellow Queenslander.

O’Dowd had also put his hand up for the position, but had lost out to Drum in the Nationals’ partyroom.

“It was good to see that Llew O’Brien, who comes from Queensland, he is only a couple of doors away from where I live and I know he will do a good job,” O’Dowd said.

“It is good to have one of our own in that position. Happy for him and happy for Queensland. We can’t be all Victoria and NSW.”

Earlier the Courier Mail reported O’Brien had quit the Nationals after a “shouting match” with McCormack over his leadership.

NSW Nationals MP David Gillespie also reportedly accused McCormack of being a “liar” after he denied that Drum had been endorsed for the deputy Speaker’s role.