Labour leader Jeremy Corbyn and shadow chancellor John McDonnell during the debate in the House of Commons on the government's Charter of Budget Responsibility.

Jeremy Corbyn has suffered the first substantial rebellion of his leadership, with more than 20 Labour MPs ignoring whips to abstain on a vote on George Osborne's fiscal charter.

The bill was comfortably passed in a Commons vote at the end of a debate that saw new shadow chancellor John McDonnell use the word "embarrassing" over and over as he sought to explain Labour's U-turn on this issue.

McDonnell – making his first appearance in the House of Commons as shadow chancellor – said that by showing "a bit of humility" he would get credit from the public for proving he is willing to change his mind.

Osborne brought forward the charter for budget responsibility, which requires the government to run a budget surplus, in an attempt to undermine Labour's economic credibility and cause problems within the opposition party.

In the end, the tactic was more successful than the Conservative chancellor could have imagined, causing a fortnight of chaos within the Labour party.

McDonnell initially announced his support for Osborne's proposed law and said he would order MPs to vote for it on the basis it would reassure voters that a Labour government would not overspend. Two weeks later he changed his mind, announcing this at an angry meeting of the parliamentary Labour party which infuriated some MPs, leading to internal splits and accusations of incompetence.

"I was trying to out-Osborne Osborne," McDonnell told the House of Commons by way of explanation.

But he insisted Osborne's law exposed the side effects of the Conservatives' economic policies: "It will be used to justify cutting services and support to families across the UK, including the cuts to tax credits, which are the working families' penalty. These are people who have done everything asked of them: They have gone to work and looked after their children, yet because of the policy direction in this charter they are going to be hit with a £1,300 cut."

Osborne used the debate to mock McDonnell: "We were told he would be a divisive figure. I just didn't realise the split would be between two opposing views he held himself."

In response McDonnell said the proposed fiscal law was a "puerile political trap" that he had initially intended to back in order to indulge in "traditional parliamentary knockabout" and ridicule Osborne's economic performance.

"The charter and the fiscal mandate are not economic instruments, they are political weapons," he insisted.

But McDonnell said a meeting with people who have lost their jobs as a result of the Redcar steelworks closing had prompted him to change his mind.

There were 21 Labour MPs who abstained without permission from the whips' office, although this was lower than had been feared. They included former leadership candidate Liz Kendall, former shadow chancellor Chris Leslie, and longtime Corbyn critic Simon Danczuk.

There had been concerns that Labour MPs would not be loyal to the new party leadership on such votes, since McDonnell and Corbyn respectively hold the titles of most and second-most rebellious Labour MPs due to their long history of ignoring orders from whips.

These are the 21 Labour MPs who abstained on the vote without permission, according to the Labour whips' office:

CORRECTION:

Oct. 15, 2015, at 09:49 AM

Penistone & Stocksbridge MP Angela Smith was among those who abstained from the vote. A previous version of this story wrongly identified her as Oxford East MP Andrew Smith. This was based on incorrect information supplied by the Labour whips' office.

Jim Waterson is a politics editor for BuzzFeed News and is based in London.