The attack occurred at about 10:30 p.m. as the woman was walking alone on Almaden Boulevard near Alvarado-Niles Road, according to Union City police.
The suspect approached the victim brandishing a handgun, police said. He forced her to the ground and took her money.
As the suspect attempted to sexually assault her, he was apparently startled by a passing motorist and fled the area on foot, running north on Almaden Boulevard.
The victim suffered minor injuries and was briefly hospitalized.
Police are asking anyone with information or who might have driven through the area at the time to contact Union City police Detective J. Luevano at (510) 471-1365.
The suspect was described as a mixed race male with a medium build, dark hair, dark eyes and a tattoo on the right side of his neck.
He was last seen wearing a light colored hoodie with the hood pulled over his head, black pants and black shoes.