There were no reports of injuries or major property damage.
The main quake was centered about 20 miles southeast Mexicali, according to the U.S. Geological Survey. It was followed quickly by a 4.9 quake and at least nine other aftershocks.
In Mexicali, five hospitals were briefly evacuated, 90,000 customers lost electricity for 14 minutes and cell phones failed to work for 20 minutes, said Rene Rosado, director of the city's civil defense.
City government offices closed for the day after the quake struck at 10:48 a.m. local time. About 300 employees emptied City Hall.
"People were very frightened throughout the city," Rosado said.
There was "minor damage" to several buildings in Mexicali, a city of 750,000 people and capital of Baja California state, said Alfredo Escobedo, the state civil defense director.
In Calexico, a California city of 40,000 people across the border from Mexicali, crews found no damage to bridges, buildings or roads, said City Manager Victor Carrillo.
"Basically it was a quick, shake-and-bake, jolt-type of thing that seemed to last 15, 20 seconds, 30 seconds at the max," said Carrillo, who was in a meeting at City Hall during the quake. "I have quite a few items on the shelves in my office and they're all intact."
Citizen reports to the USGS indicated it was also felt in southern Nevada and metropolitan Los Angeles.
In Yuma, Ariz., Sally Zeller, a 31-year-old waitress at Brownie's cafe, said she and most everyone in her restaurant felt the quake for several seconds.
"It rumbled under our feet and the soup counter rumbled against my hip," Zeller said. "The chandeliers were swaying. It was like, 'Whoa!"'
The quake was centered in a seismically active desert valley near cities with low-rise buildings.
It occurred 4.3 miles deep and was considered a shallow quake. Shallower quakes have the potential to cause more damage than deeper ones.
A quake the size of Wednesday's main shock rattles the region about every 10 years, said Kate Hutton, a seismologist at the California Institute of Technology.
Associated Press Writers Alicia Chang and John Antczak in Los Angeles, Amanda Lee Myers in Phoenix and Mariana Martinez in Tijuana, Mexico, contributed to this report.