Yesterday's carnage at the popular Mediterranean resort of Port el Kantaoui came the same day a suicide bomber killed 27 people at a Shiite mosque in Kuwait and a suspected Islamist attacked a factory in France.
There was no immediate claim of responsibility for the Tunisia attack, but the Islamic State group, which Monday marks the first anniversary of its "caliphate" straddling Iraq and Syria, said it bombed the Kuwait mosque.
Witnesses described scenes of panic after the shooting at the five-star Riu Imperial Marhaba Hotel on the outskirts of Sousse, about 140 kilometres south of Tunis.
British Foreign Secretary Philip Hammond said in London five Britons had been killed and warned that the toll could rise.
More From This Section
"Because of the nature of the composition of the tourist population in this part of Tunisia we have to assume that a high proportion of those killed and injured will have been British," he said.
A spokesman for Spain's RIU group said most of the 565 hotel guests were from Britain and "central European countries".
In Dublin, Foreign Minister Charles Flanagan said an Irish woman was among the dead.
Secretary of State for Security Rafik Chelly told Mosaique FM the gunman was a Tunisian student previously unknown to the authorities.
"He entered by the beach, dressed like someone who was going to swim, and he had a beach umbrella with his gun in it. Then when he came to the beach he used his weapon," Chelly said.
British tourist Ellie Makin saw the attack unfold.
"All I saw was a gun and an umbrella being dropped," she told ITV television.
"Then he started firing to the right hand side of us. If he had fired to the left I don't know what would have happened, but we were very lucky."