Spain is bordered by two major marine bodies:
The Strait of Gibraltar (14 km wide) connects them. Spain also has coast on the Cantabrian Sea (southern Bay of Biscay) and the Balearic Sea (around Balearic Islands).
No landlocked point in Spain is >~500 km from either ocean.