Honolulu has become the first major US city to ban pedestrians from looking at mobile phones, texting or using digital devices while crossing the road.
The measure, which will take effect in Hawaii's largest city in October, is aimed at reducing injuries and deaths from "distracted walking".
First offenders caught gazing at devices, including laptops and digital cameras, face $15-$35 (£11-£26) fines.
Urgent calls to the emergency services are exempt from the ban.
The bill, also known as the Distracted Walking Law, was signed off by the mayor of Honolulu, Kirk Caldwell, on Thursday after the city council approved the measure by a vote of 7-2.
The new legislation, which will come into effect on 25 October, states that "no pedestrian shall cross a street or highway while viewing a mobile electronic device".
Repeat offenders face fines of up to $99.
The new law has met opposition from some members of the public, who accuse the government of over-regulation.
"We hold the unfortunate distinction of being a major city with more pedestrians being hit in crosswalks, particularly our seniors, than almost any other city in the county," Mr Caldwell told Reuters news agency.
"Sometimes I wish there were laws we did not have to pass, that perhaps common sense would prevail, but sometimes we lack common sense," Mr Caldwell said.
Distracted walking incidents involving mobile phones accounted for more than 11,100 injuries in the US between 2000 and 2011, according to the US National Safety Council.
The figures for more recent years, which are not provided in the council's latest report, are likely to be higher.