Tidal power is more viable, however, although estuaries provide better options than straits, as they already funnel a large volume of water into a decreasing width.
There is a gradient: a pressure gradient. Actually, there are two, just to make things interesting. There is a continuous and significant flow of water from the Atlantic into the Med to replace water lost by evaporation. In the past this has been blocked which has resulted in the Med drying out. There’s a similar but lesser flow between the Black Sea and the Med. Further, there is an outflow of high-salinity water from the Med to the Atlantic. So you’d get double duty: you have turbines at both the top of the dam and the bottom. The technical problem here, to which I seek an answer is the issue of being able to let enough water through. Unlike most dams, you can’t impede the flow of water too much, lest you turn the Med into the Dead Sea Mark 2.
I think there’s two currents in the bosphorus - one on the surface going one way and one deep down going the opposite way. You can see it if you drop a line with a heavy weight on the end - it will move against the current.
Don’t know whether that has implications for your question, just thought I’d mention it. And it wouldn’t be Spain, the dam would have to go from Gibraltar (owned by Britain).
Damming the Med is something that’s been discussed in science fiction before as a means of generating enough electricity to supply Europe. Whether that would really generate that much power is pretty speculative. As a bonus, you can put a road on top and boost Africa-Europe commerce, though you’d also want to figure out a way to allow shipping to pass through as well.
Any dam on the Bosphorus resulting in a large-volume reservoir could well trigger earthquakes, and Turkey needs more earthquakes like Amy Winehouse needs a new drug habit.
Damming the Bosporus at least would seem to violate the Montreux Convention, which guarantees freedom of navigation through the Turkish Straits (Bosphorus and Dardanelles).
I don’t know of any treaty specifically regarding the Strait of Gibraltar, but the issue of straits in general has been the subject of a lot of international wrangling, and the upshot seems to be that there is an international right to transit through various straits, including the Strait of Gibraltar.
So closing off either the Bosporus (and/or Dardanelles) or Strait of Gibraltar would have international ramifications.
Although per the Montreux Convention they still can’t send aircraft carriers through the Turkish Straits; and there are other restrictions on warships going through the straits.
Presumably if you dammed either strait you would also build a ship canal with locks so that ships could go through.
If damming at the western end of the Mediterranean lowered the sea level significantly, you start getting a stronger current northwards through the Suez Canal, which has no locks last time I looked. If the current were strong enough, it might make travel through the Suez Canal difficult in either direction, but the problem could be solved by putting a pair of locks in the Suez Canal.
There have been proposals to harness the tides at Mt. St. Michel (on the boundary between Normandy and Brittany where the tide is said to run faster than a horse and on the Bay of Fundy where tides range from 40 to 80 feet. One insuperable (so far) problem has been finding materials that can stand up to the salt water. I also heard of a proposal to build a tunnel with turbines from the Med to the Dead Seas. There are obvious political problems with that, but it could generate power and also rejuvenate the Dead Sea which is shrinking owing to Jordan river diversion.
Italy might kick in a few bucks to make it happen; it would answer the question of what to do about Venice sinking. Of course, lower it too much and the canals would run dry. They probably wouldn’t like that, either.