The US president is said to have made the suggestion during a meeting with Josep Borrel, Spain's foreign minister.
Spain does have a border wall in Africa, where its tiny enclaves of Melilla and Ceuta are separated from Morocco by rows of wire fences.
Borrell said that after offering his advice, Trump said, "The border with the Sahara can't be bigger than ours with Mexico".
Borrell continued: "Well, yes, it is way bigger than the border with Mexico, and in any case it wouldn't be very useful to do that".
RFG Advisory Group LLC Acquires 1,052 Shares of Apple Inc. (NASDAQ:AAPL)
Global Financial Private Capital LLC bought a new stake in shares of Apple in the 1st quarter worth about $13,771,000. As an iPhone 8 owner, I'm now paying nearly the exact amount that Cook referenced, in fact, US$29.12 per month.
A ministry spokesman tells the Guardian: "We can confirm that's what the minister said, but we won't be making any further comment on the minister's remarks".
The White House did not immediately respond to a request for comment.
Fact is the Sahara desert is 3,000 miles long, which is approximately 1,000 miles longer than the U.S. Mexican border. Spain is not one of them, so any wall would have to be built entirely on other nations' land.
Trump campaigned for president on the promise that he would wall off Mexico to stop illegal immigrants entering the US.
Nawaz Sharif, daughter, son-in-law's jail sentences suspended in corruption case
On Wednesday, a division bench comprising of the high court suspended the father-daughter's sentence. The trio were briefly allowed out of the high-security Adiala Jail on parole to attend her funeral.
The plan has been complicated by funding disputes, complex property transactions and the opposition of Democrats in Congress. Mexico has refused to pay for it.
The Trump administration has proposed spending $18 billion over 10 years to extend the border wall with Mexico.
The country does possess two small territories in Africa, Ceuta and Melilla, but these are situated on the northern coast of the continent - well away from the Sahara desert, which stretches across almost a dozen countries.
Migrants have increasingly been looking to Spain after being shunned by Italy's populist government, which has worked to clamp down on refugees, going so far as to shut its ports to migrant rescue ships.
Can sorry for ´we´re not women´ blast over Ronaldo red card
The red card could ruin the chances of a reunion between Manchester United and Ronaldo at Old Trafford. I think if you have seen the pictures, you'll have seen that it's incomprehensible", Matuidi said.