The incident happened on Friday at Arrabassada beach when a group of six boys jumped into the sea from rocks while a yellow warning flag was flying because of strong waves.
Three of the boys made it back to shore unaided, while the others were rescued by emergency crews.
A 12-year-old boy died at the scene despite efforts to resuscitate him, while two 13-year-olds were taken to hospital in a critical condition, regional emergency services said.
The two teenagers later died in hospital.
The president of Catalonia, Salvador Illa, said he was “deeply saddened” by the deaths, writing on X that “there are no words at a time of such sorrow”.
Tarragona city council declared three days of official mourning.
“Unnecessary risks should not be taken. Under no circumstances should people jump from the rocks,” said Tarragona mayor Ruben Vinuales.