Borrell's anecdote didn't specify when and in what context Trump voiced his suggestion, which may have been intended as a joke.
However, the plan differs from Trump's suggestion for Spain in that Madrid would need the cooperation of foreign nations to build the wall. The minister impersonated Trump's voice as he spoke, according to an audio file heard by CNN.
President Donald Trump's obsession with building walls has apparently gone global.
The White House disputed the account.
According to the Spanish foreign minister, Trump, asked if he was aware of the size of the Sahara, replied: "It can't be bigger than our border with Mexico". Trump disagreed, according to Borrell's recollection, adding that "the Sahara border can't be bigger than our border with Mexico".
A Spanish foreign ministry spokesman confirmed that Mr Borrell had said what was reported, "We can confirm that's what the minister said, but we won't be making any further comment on the minister's remarks". The desert spreads over parts of 11 countries: Algeria, Chad, Egypt, Eritrea, Libya, Mali, Mauritania, Morocco, Niger, Sudan and Tunisia. "So it could be a steel wall with openings, but you have to have openings because you have to see what's on the other wide of the wall". Filling almost all of North Africa, the Sahara measures approximately 3,000 miles from east to west, according to the Encyclopaedia Britannica.
Central American migrants sit on the US-Mexico border wall at its westernmost point, Tijuana, Mexico.
During his campaign, Trump had promised to build a wall along the southern border with Mexico and force the Mexican government to pay for it.
Spain's politicians have agreed a solution needs to be found to deal with the migration crisis, with Africa's population set to double in the next 20 years. They are Europe's only land borders with Africa. They have become magnets for African migrants seeking a better life in Europe and refugees fleeing persecution and conflict.
Last month, several hundred migrants stormed a border fence to enter Ceuta, leaving more than 150 people injured.