It only took one phone call.

For 16 years, the FBI had pursued James “Whitey” Bulger, chasing the elusive Boston mobster across five continents. On Tuesday, agents tried a new approach: They blasted photos of Bulger’s longtime girlfriend, Catherine Elizabeth Greig, across television screens and Twitter.

Within hours, the call came to the FBI’s Los Angeles office. Someone who frequented a Santa Monica apartment complex had seen the unusual publicity campaign — and recognized Bulger and Greig.

With that, the long search was over. Agents and police descended on the complex three blocks from the Pacific Ocean, where Bulger and Greig had been living for some time, and arrested them. The pair had been on the lam since 1995.

The sudden discovery of the crime boss who vanished, the man with the bright platinum hair who enlisted the help of a corrupt FBI agent in his escape, transfixed people in the city where Bulger once ruled the underworld. Called “Boston’s boogeyman,’’ Bulger had seen his legend grow in his absence.

Even as agents chased clues around the world, with “sightings” of Bulger in at least 44 states, he inspired the Jack Nicholson character in the movie “The Departed.’’ Known to some as a Robin Hood-like figure who helped his working-class neighbors in South Boston, he also was wanted in 19 killings, said to be so ruthless that he insisted on pulling out his victims’ teeth so they couldn’t be identified.

The search was made more intriguing by Bulger’s complicated relationship with the FBI and Boston’s political elite. While he reigned atop the city’s Winter Hill Gang, he doubled as a government informant, even as his brother ascended the ladder of Massachusetts politics.

But in the end, it was a balding, 81-year-old Bulger, with a full white beard and wire-rimmed glasses, who appeared Thursday in federal court in Los Angeles and was ordered returned to Massachusetts for trial, according to the Associated Press. He faces federal charges that include murder, narcotics distribution and extortion. Greig is charged with harboring a fugitive.

Lawyers for the pair could not be located.

“Although there were those who have doubted our resolve . . . it has never wavered,’’ said Richard DesLauriers, special agent in charge of the Boston division of the FBI, which put Bulger on its “Ten Most Wanted” list in 1999. “We followed every lead, we explored every possibility, and when those leads ran out we did not sit back and wait for the phone to ring.’’

What the bureau did was something that ran somewhat counter to its traditional straightforward approach: It launched a unique media campaign. Featuring billboards in New York’s Times Square and a heavy dose of Facebook and Twitter, the effort focused on Greig and the couple’s relationship.

The level of detail was classic FBI. Greig likes beauty salons, loves animals and “is likely to have well-kept teeth because she previously worked as a dental hygienist,’’ the bureau said in a news release Monday.

But the campaign was also sophisticated. The FBI paid about $50,000, mostly to run public service announcements in 14 cities, airing on shows with a high percentage of female viewers in the same age group as Greig, 60. The campaign followed an earlier effort to find Greig and Bulger in which the bureau bought ads in plastic surgery and dental association newsletters seeking doctors who had treated the couple.

Ironically, Los Angeles was not among the 14 cities. But officials said the tipster had seen mass media coverage of the new campaign.

When they got the call, Los Angeles agents relayed word to their Boston counterparts, who asked the Los Angeles office to begin surveillance of the third-floor apartment. Agents and police soon identified “two individuals who appeared to resemble the two fugitives,’’ DesLauriers said.

Using a ruse that the FBI would not disclose, agents lured Bulger outside, arrested him and then arrested Greig inside the apartment, where a variety of guns and a large amount of cash were found, DesLauriers said. Bulger, who did not resist, confirmed his identity to the agents, according to federal law enforcement officials, who spoke on the condition of anonymity to discuss specific details.

Authorities said the couple had been using the aliases Charles and Carol Gasko.

“We’re very very fortunate that persistence paid off,’’ Carmen M. Ortiz, the U.S. attorney in Boston, said at a news conference. “At least now, we have the opportunity to prove our case.’’

The investigation of Bulger’s crime ring has ensnared dozens of former associates, friends and family members but has also caused headaches for the FBI.

Former FBI agent John Connolly, who grew up next door to Bulger in the tightknit Irish enclave of South Boston, was sent to prison for tipping off the mobster that his arrest was imminent, allowing Bulger to flee the city.

Bulger, who ratted out his rivals in the Italian Mafia as a government informant, also had political connections. His brother, William M. Bulger, was a Democrat who presided over the Massachusetts state Senate for two decades and became president of the University of Massachusetts system. He was forced to resign over refusing to talk during a 2003 congressional inquiry about James Bulger’s activities.