Officers were hit with rocks, bottles and eggs, police said, and the crowd directed pepper spray at them.
KSWB-TV tweeted video of counter demonstrators, most of them dressed in black and waving an antifa flag, throwing a folding chair and spraying a chemical irritant at a smaller group of people participating in the march on the Pacific Beach boardwalk.
The station said in other instances, members of both groups shoved and threw objects at one another.
Police sent in dozens of officers in riot gear to separate the two groups. Police asked residents to stay away from the area and warned that those who refused to disperse may be cited or arrested.