After a bad-tempered debate on Wednesday, SNP and Scottish Green MSPs backed a motion not to remove the flag at 11pm on Friday when the UK leaves the EU.
Members voted by 63 to 54, with one abstention, in favour of the motion.
The vote was called this week in response to a decision by the Scottish Parliament's Corporate Body (SPCB) to remove the flag after Brexit.
However, some members opposed holding the vote in the first place as they complained it was a waste of parliamentary time.
But Culture Secretary Fiona Hyslop said: "We need to give practical demonstration to the sense of loss that so many in this chamber and beyond will feel when we are no longer members of the European Union."
She said the vote gave the Scottish Parliament a choice on the issue, adding the SPCB's decision to remove the flag "does not reflect the views of Parliament as a whole".
During her speech, Ms Hyslop repeatedly rejected an intervention from Labour MSP Neil Findlay, which he could be heard describing as "a disgrace".
Mr Findlay raised a point of order with Deputy Presiding Officer Linda Fabiani, complaining backbenchers were not due to speak in the debate and so should be allowed to interject.
Rudeness in the chamber
Ms Fabiani stepped in to chide MSPs for being "rude" in the chamber.
Scottish Tory MSP Ms Smith said the passing of the motion would set a dangerous precedent of the Government overruling the SPCB - which is supposed to remain neutral.
She said: "It is vital that there is full trust and confidence in the work of the corporate body to act in an impartial manner on behalf of all members, rather than on behalf of the political parties of the Parliament.
"The issue before this Parliament today is not what we think about the withdrawal of the UK from the EU, it's about whether members of this Parliament are prepared to undermine the corporate body.
"Are we well aware of the dangers that could provide?"
Shame or embarrassment?
Later in the debate, tempers flared between Scottish Green MSP Ross Greer, Tory justice spokesman Liam Kerr and Liberal Democrat MSP Liam McArthur.
After announcing his support for the motion, Mr Greer took an intervention from Mr Kerr in which the Tory claimed his request for a ministerial statement on the state of the police estate in Scotland had been refused due to "lack of time".
Mr Kerr asked the Green MSP if he feels "any shame or embarrassment" for supporting such a debate going ahead.
Mr Greer responded: "I'm sure Mr Kerr enjoyed that moment of self-indulgence but I'm going to come to the point of the hypocrisy of the Tories in a moment."
The Green MSP also chastised the Liberal Democrats, who had indicated before Mr McArthur spoke that they would not support the Government motion.
He said: "The only real losers here are the Liberal Democrats - the party of Europe - who, unless they're about to make some significant U-turn, are set to vote with the Conservatives to take the flag down."
In response, Mr McArthur said: "It's a matter of deep regret to me that this Parliament is having this debate on this Government motion and has just been subjected to that contribution from Ross Greer."