The shortest border shares with any of it's neighbors is with the United Kingdom Territory of Gibraltar less than 2 miles, followed by a total land border of about 7.5 miles with Morocco, about 35 miles with Andorra, and lastly about 400 miles with Portugal.
These are crude estimates based on an eyeball guess of the length of a border displayed on a map of each area on Wikipedia. The sequence is definite, only the exact length is in question.
The only country sharing a border with Portugal, that is, Spain
Luxembourg
There are 16 countries that touch the border of China. Hong Kong has the shortest border touching China with the length of 30 km.
Portugal shares Spain's western border.
France is on the north east border of Spain
Gibralta is on the southern border with Spain.
Spain shares a border with Portugal.
Cheshire
Spain is the only country to border Portugal. Spain is on two sides of Portugal, with the west and south side being the Atlantic Ocean. Spain
France
Portugal, Andorra and France.
France and Portugal