Biologists had said they had not expected the female sandbar shark to survive because it stopped swimming after being brought to the aquarium on Monday and needed help from divers to keep moving, and thus breathing.
An autopsy will be carried out to determine the cause of death, the aquarium said in a statement.
Biologists captured the 90-kilo (200-lb) fish Monday in knee-high water at a beach called Miracle in northeast Tarragona province, grabbing it with their bare hands and dragging it ashore.
The shark first turned up early last week and became a novelty by swimming regularly into plain view in very shallow water. Authorities closed the beach to swimmers.
After the shark was taken to the aquarium, biologists determined its dorsal fin had been punctured by a harpoon and that it had some kind of internal problem, possibly from swallowing an object.