A rapprochement between Labour and the Liberal Democrats has been signalled as Ed Balls indicated he could imagine forming a coalition with Nick Clegg if no party secured an overall majority after the next general election.

In a New Statesman interview, the shadow chancellor said he understood "totally" why the Lib Dem leader had formed a coalition with the Tories after the 2010 general election – to ensure that Britain had a "credible" deficit reduction plan.

His interview prompted something of a Twitter love-in between the two politicians. Clegg made light of the interview by tweeting: "Ed Balls" – a skit on Balls's famous Twitter faux pas, which spawned Ed Balls Day, when he tweeted his own name when he was searching for tweets about himself.

Balls qualified his New Statesman remarks by saying it would be hard for Labour to join a coalition and that Clegg was wrong in 2010 to accelerate Alistair Darling's deficit reduction plan – to halve it over four years – in favour of eliminating the structural deficit by the end of this parliament. This target was missed.

The remarks by Balls contrasted sharply with his declaration in September 2012 when he told the Andrew Marr Show on BBC1 that it would be "really hard" to form a coalition with Clegg because of the "way he's gone about his politics".

During the 2010 Labour leadership contest Ed Miliband ruled out forming a coalition with the Lib Dems as long as Clegg remained leader.

A Lib Dem source said there had been a thawing in relations with Labour in recent months.

The shadow chancellor highlighted how Labour's attitude to Clegg, the deputy prime minister, had evolved even though Clegg told LBC last month that he avoided feuds except for "a man named Ed Balls" – remarks described by the Lib Dems as a joke.

The shadow chancellor told the New Statesman that he had a chat with Clegg at Westminster on Monday afternoon following the latter's attack on George Osborne for his "monumental mistake" in drawing up plans for £12bn cuts in 2016-2018.

Speaking later that evening, Balls said: "I had a friendly chat with him a couple of hours ago in the House of Commons … We had a nice chat about how things were going. I think it was the first time I'd had a conversation with him for a really long time."

In a sign of new warmth towards Clegg, Balls said he understood why he formed a coalition with the Tories. "I understand totally why Nick Clegg made the decision that he made to go into coalition with the Conservatives at the time.

"I may not have liked it at the time, but I understood it. I also understood totally his decision to support a credible deficit reduction plan, because it was necessary in 2010."

But he said Clegg was wrong to agree to a more rapid deficit reduction plan than the Lib Dems floated during the 2010 general election campaign. The Lib Dems said in their manifesto that imposing cuts too soon "would undermine the much-needed recovery and cost jobs".

Balls said: "I think the decision to accelerate deficit reduction, compared to the plans they inherited, which was clearly not what Vince Cable wanted, I think that was a mistake. I don't know whether that's something that, in the end, the Liberal Democrats will acknowledge. I think the decision to support the top rate tax cut and the bedroom tax, that was a mistake, those were an unfair combination. I think that the decision to go along with the boundary changes in return for the AV referendum was a mistake, which I think Nick Clegg acknowledged by reneging on his half of the deal in retrospect."

The shadow chancellor made clear that he would be working hard to ensure Labour wins an overall majority at the next election but indicated that he might be prepared to form a coalition with the Lib Dems if no party wins a majority.

"You always have to do is deal with politics as you find it. We're fighting hard for a majority, who knows how things will turn out. Very many Labour party members, voters, supporters, would find that [a coalition] very difficult and some Liberal Democrat voters would find that very difficult as well. But we'll deal with the situation as we find it. I saw that subsequently he made a further statement to one of the newspapers that these things weren't about personalities, and I think he's right about that."

A Lib Dem source said: "There has been a thawing in relations with Labour in the last year. But that does not mean that we are pitch-rolling for a coalition with one party or the other. Our position will always be that it is up to the British people to decide."

The source added that Clegg, who believes the Lib Dem role is to act as a restraining influence on the two main parties, is reviving the party's "equidistance" between Labour and the Tories – the approach abandoned by Paddy Ashdown when he embarked on talks with Tony Blair before the 1997 general election.

The source said: "We are equidistant between the two parties. We favour neither. We are not an annex to any other party. The Conservatives cannot be trusted to build a fair society while Labour cannot be trusted to build a strong economy."