Barnier will lead the negotiations for the EU side which are expected to start in late May.
Britain reacted angrily after the European Union said last week that Spain should have a veto on extending any trade deal to Gibraltar after the British leave the bloc.
"Keep calm and negotiate," France's Barnier said, in English, to reporters in Luxembourg when asked what he would say to London to reassure them on the issue.
British authorities coined the phrase "keep calm and carry on" in World War II to motivate the populace and it is regarded as an example of British stoicism in crisis.
Asked if he believed Gibraltar would remain under British sovereignty, he added in French: "Legally speaking, Gibraltar will leave the European Union at the same time as the United Kingdom, that's what I can say."
Barnier, a former European Commissioner and French minister, will lead the negotiations for the EU side which are expected to start in late May.
He stressed that "unity of the 27" remaining EU member states was crucial to the success of the Brexit negotiations ahead of its exit on March 29, 2019.
British Prime Minister Theresa May triggered the formal divorce process last week, nine months after Britons voted in a referendum to leave the EU.
London and Madrid have had a long and bitter dispute over the huge rock off Spain's southern coast, which has been a British territory for more than 300 years.
British rhetoric quickly heated up after the EU's Brexit negotiating guidelines released on Friday included a section saying Spain must have a say on any future trade deal involving Gibraltar.
Michael Howard, a former leader of the ruling Conservative Party, noted on Sunday that former PM Margaret Thatcher took military action after Argentine forces invaded the Falkland Islands 35 years ago and said current leader May would "show the same resolve" on Gibraltar.
Spain voiced surprise at Britain's tone on Monday, with Foreign Minister Alfonso Dastis saying "the traditional British phlegmatism is conspicuous by its absence."