The confrontation happened shortly before noon in the 1400 block of 150th Avenue near San Leandro's eastern border.
Two suspects had made threats to another person in the apartment complex and one of them pulled out a gun, Alameda County sheriff's Sgt. Ray Kelly said.
The victim left the complex and called authorities, as did a neighbor who witnessed the incident, Kelly said.
The suspects went into an apartment and sheriff's deputies responded to the neighborhood and closed nearby roads. The streets reopened by 2 p.m., Kelly said.
"We shut the streets down for safety purposes," Kelly said. "Now everybody's fine."
The two men eventually came out of the apartment and were arrested on charges of brandishing a firearm and making threats, Kelly said. They were taken to Alameda County Jail.