WASHINGTON — President Obama on Tuesday appointed Julia A. Pierson, a longtime Secret Service agent, as the first woman to head the agency best known for protecting the president, vice president and their families.

Ms. Pierson, the chief of staff to Mark J. Sullivan, who retired as director last month, will take over at a time when the Secret Service is still recovering from a prostitution scandal last year that held it up to public ridicule, generated Congressional hearings and cost a number of agents their jobs.

The appointment represented a milestone for law enforcement, putting a woman at the top of an agency with a storied past and a Hollywood-fueled image of Clint Eastwood-style men with sunglasses and earpieces stoically guarding the commander in chief at home and abroad. Mr. Obama has also installed women as directors of the Marshals Service and Drug Enforcement Administration, but the Secret Service has a unique visibility.

With 30 years of experience in the Secret Service, Ms. Pierson, 53, boasts a résumé much like those of her predecessors, including a stint on the first President George Bush’s protective detail. But the timing of her selection inevitably means that Washington will be watching closely to see how or if she changes a male-driven culture that came under harsh scrutiny when agents were caught employing prostitutes in Colombia before Mr. Obama arrived for a visit.