Joseph DeAngelo is suspected of being the so-called Golden State Killer, blamed for a spate of murders and rapes in the 1970s and 1980s.
DNA linked the crimes but police had struggled to identify the attacker.
Investigators revealed the search was narrowed with genetic information from websites used to trace family ancestry.
Mr DeAngelo, who was arrested on Tuesday, has initially been charged with eight counts of murder. He is due to make his first court appearance in Sacramento later on Friday.
Steve Grippi, chief deputy district attorney for Sacramento County, said detectives had compared the DNA to information on genealogical website databases and narrowed the search down to several families.
They then narrowed the search further by using the age profile of the killer.
Police said Mr DeAngelo, a former police officer, was placed under surveillance and then arrested when "discarded DNA" matched him to crimes.
It is not clear if the genealogy websites involved were ordered to provide the information or did so voluntarily.
Mr DeAngelo lived in Citrus Heights, a suburb of Sacramento, not far from the scene of the first murders.
The Golden State Killer - also known as the East Area Rapist, Original Night Stalker and the Diamond Knot Killer - is believed to have carried out 12 murders, 51 rapes and more than 120 burglaries between 1976 and 1986.
The crime spree terrorised communities in Sacramento, San Francisco and in central and southern California.