"I heard a lifeguard yelling at the swimmers 'Get out, Get out!' I thought someone was hurt," holidaymaker Angela told Italy's Rai news on Monday, after the all-clear had been given to go back in the water in Ostia.
One excited tourist told Il Messaggero daily how "the lifeguard saw the shark's fin and sounded the alarm. There was panic, particularly among the mothers who rushed to get their children out."
Bikini-clad sunbathers crowded at the waterline to catch a glimpse of the shark, with many filming the scene on their smartphones.
The two-metre-long (6.5-foot) shark, which circled the area for a few minutes before heading back out to sea, probably came close to the shore in search of food, according to geologist Mario Tozzi.
He said the blue shark, which usually inhabits deep tropical waters, is not considered dangerous unless it feels threatened.
Their usual diet includes anchovies, mackerel, sardines, birds, seals, turtles and squid.
Tozzi warned against "inciting a shark hunt. Sharks have a bad reputation, but every year more people die from being hit on the head by a coconut than from a shark bite."