The confidence motion, which was demanded by the Scottish Conservatives – as a result of the delay in legal advice to the Holyrood committee inquiry on the government’s handling of sexual harassment complaints against Alex Salmond – saw the Greens vote with the SNP to save Mr Swinney.
The vote was defeated by 65 votes to 57.
The confidence motion was the second Mr Swinney has faced during the Covid pandemic, but he similarly survived the August vote, which saw him criticised over the chaos of the examination awards, again with the support of the Scottish Greens.
However during the debate he was warned by Scottish Liberal Democrat Alex Cole-Hamilton that he may face yet another vote of no confidence if, in his role as Education Secretary, he fails to release an OECD report into the state of Scottish education, which the Scottish Parliament has already voted that he should.
Scottish Conservative Holyrood group leader Ruth Davidson, said the government had ignored the will of parliament and it had taken a threat of vote of no confidence for Mr Swinney to change his mind and release “key legal advice”, which she said had “proved incontrovertible evidence of incompetency on the part of the government.”
Ms Davidson said that despite this, there evidence was incomplete and notes from vital meetings had not yet been handed to the committee, which “had been hampered at every turn”.
She added: "We believe that John Swinney and the government have failed in its duty.”
Mr Swinney said the motion was “entirely baseless” as the government had provided the committee with “thousands and thousands of documents”. But he went on to reveal that minutes or notes of meetings which the committee had been demanding were unavailable.
“We simply don't have those. We’ve asked senior counsel if they have a minute of these meetings and they do not,” he said.
"The outcomes of these discussions are reflected in the pleadings made to the court by the government which we shared with the committee some months ago.”
Scottish Labour’s Jackie Baillie said the government had treated parliament and the committee with “contempt” and that while the vote was on the actions of Mr Swinney “I am clear it is on the behaviour of the Secretive National Party”.
She described the lack of note taking at meetings between government and legal counsel as “inconceivable” and said there was “a pattern of behaviour which is one of obstruction, secrecy and contempt for this parliament.”
She also accused the Scottish Greens of “once again riding to the rescue of the SNP, regardless of the catastrophic failings of the government.”
The Scottish Liberal Democrats voted with the motion, and leader Willie Rennie said “many reasonable people will find it surprising that Patrick Harvie condones the behaviour of John Swinney."
But Patrick Harvie said the committee had been “allowed to come little more than shabby political theatre” with “members obsessed with winning a political scalp”.