Spain and Portugal are treated as interchangeable and are not. They differ on the one variable that decides whether a beach holiday works, which is how cold the water is, and they differ again on cost, crowding and how long the usable season runs. Choosing well is mostly a matter of knowing which coast you are actually comparing.
Which has the warmer sea?
Spain, decisively, if you mean the Mediterranean coast. The Costa Blanca and Costa del Sol sit at around twenty-four degrees in August and stay swimmable into October. Portugal faces the Atlantic, and the Atlantic off Iberia is cold. The west coast rarely exceeds eighteen or nineteen degrees even in high summer, which is bracing rather than pleasant for most people.
The exception matters. The Algarve faces south rather than west, and the eastern Algarve around Tavira and Monte Gordo is several degrees warmer than Lagos or Sagres a short drive away. If you want Portugal and warm water, that stretch is the answer.
Which has the better beaches?
Portugal, on almost any measure other than temperature. The Algarve cliffs, the coves around Lagos and the vast empty sands of the Alentejo are more dramatic than anything on the Spanish Mediterranean, and they are less built up. Spain answers with the Balearics and the far north, where the beaches of Menorca and the Costa Brava coves compete on equal terms.
Which is cheaper?
Portugal, though the gap has narrowed and is now mostly visible in restaurants rather than hotels. A meal out in the Algarve is typically a fifth to a quarter less than an equivalent in the Costa del Sol, and wine noticeably so. Accommodation is close to level in peak season and cheaper in Portugal outside it. Flights are usually cheaper to Spain, simply because there are more of them.
Which is better with children?
Spain, for the water temperature alone. Small children in nineteen-degree Atlantic water last about four minutes. The Mediterranean resorts also have shallower entries, more sheltered bays and a far larger supply of hotels built around families. Portugal works with older children who want to surf, which is a real strength of the west coast.
How long does the season last in each?
The Spanish Mediterranean gives you late May to mid-October for swimming, and the Canaries extend that to the whole year. Portugal is a shorter season, roughly late June to late September, because the Atlantic warms slowly and cools quickly. If you are travelling in May or October, Spain is the safer choice by some distance.
What about crowds?
Portugal is quieter everywhere except the central Algarve in August, which is as busy as anywhere in Spain. Spain has more capacity and therefore more variation: Benidorm and Magaluf in August are extreme, while the Costa de la Luz or inland Almeria are calm in the same week. Crowding in Spain is a matter of which resort you chose, not which country.
Who should choose which?
Choose Spain if you want warm water, a long season, a family beach or a wide choice of flights. Choose Portugal if you want better scenery, lower prices in restaurants, surf, and somewhere that feels less developed. If you want the best of both, the eastern Algarve gives you Portuguese prices with something close to Mediterranean water.
Which coast should you actually compare?
Country is the wrong unit. Spain alone contains the warm shallow Mediterranean of the Costa Blanca, the cold Atlantic of the Basque coast, the Atlantic-facing Costa de la Luz and the year-round Canaries, and those four have almost nothing in common. Portugal splits between a cold west coast and a much warmer southern Algarve. Before booking, find the sea temperature for the specific resort in the specific month, because a two-hour drive along the same coastline can change the water by four or five degrees, which is the difference between swimming and paddling.
Which European Countries Are Cheapest to Visit? is the natural next read, alongside the wider Destinations section.
The short answer
For swimming, Spain. For looking at, Portugal. Check the sea temperature for the specific stretch of coast rather than the country, because the difference between two Portuguese beaches an hour apart is larger than the difference between the two countries.