Maryland Gov. Larry Hogan, center, leaves a news conference alongside state transportation secretary Pete K. Rahn after announcing tentative approval of the Purple Line. (Patrick Semansky/AP)

It took a lot of spreadsheets to persuade Maryland Gov. Larry Hogan (R) to say “yes” — with conditions — to the Purple Line.

In multiple meetings during his first five months in office, Hogan pored over documents packed with data on ridership, jobs and, above all, costs for the light-rail link between Montgomery and Prince George’s counties.

The longtime transit skeptic was still studying them on Thursday before the news conference where he gave the project tentative approval.

“I’ve never seen a governor devote this much time to a single project,” said Maryland’s transportation secretary, Pete K. Rahn, who has served five other governors in top transportation jobs in New Mexico and Missouri.

How Hogan came to approve the project offers a valuable early look at his governing style. It suggests he can be pragmatic and flexible, even at the risk of disappointing his conservative political base. It also shows he drives a hard bargain, as befits a man who built a career in commercial real estate.

In the end, Hogan’s decision came down to whether residents of Maryland’s Washington suburbs would use the Purple Line; whether the cost could be trimmed and the state’s contribution lowered; and whether he could build it and still meet his primary goal of boosting spending on highways and bridges.

The governor’s process “had no hint of politics or partisanship whatsoever,” said Montgomery County Executive Isiah “Ike” Leggett (D), a strong Purple Line advocate. “I think you have to give him very much credit that he was willing, open and ready to listen, and his transportation secretary was extremely open and willing to be a partner.”

Rahn said he concluded early on that it was a good idea to build the 16-mile rail line — provided the cost could be reduced sufficiently from the original price tag of $2.45 billion. But Rahn wasn’t sure until the very end that Hogan would agree.

“He had a lot of questions. Every time I met with him, I would leave with another list,” Rahn said. “The governor was skeptical in the beginning. His position, obviously, evolved.”

For Hogan, a first-time officeholder, there were plenty of political reasons to simply kill the Purple Line.

The governor was elected with overwhelming support in rural and outer suburban communities that don’t use rail transit and would not benefit directly from the project. He lost Montgomery and Prince George’s by big margins.

Hogan has complained for years that Maryland was spending too much money on transit at the expense of roads, which more people use. On the campaign trail, he said Maryland “simply cannot afford this project right now.” When he hired Rahn — one of his only top aides from outside Maryland — Hogan touted him as a road builder.

The governor also has a history of doubting the promises of traffic relief and economic growth that transit backers routinely advance to promote their projects. He is a former director of the Maryland Public Policy Institute, a free-market-oriented think tank that contends light-rail projects are never economically justified.

Rahn said he “was encouraged because the governor could have said quite early, ‘We’re not doing this.’ He remained open throughout this process.”

Even as he approved the Purple Line, Hogan decided to kill another light-rail project, Baltimore’s $2.9 billion Red Line, which he dismissed as economically unfeasible. The decision showed his willingness to put the ax to projects he considers a waste of money. It also freed up plenty of funding for highways and bridges throughout the state.

In what analysts called a tough-minded negotiating ploy, the governor attached conditions to the Purple Line deal designed to shift costs away from the state.

Montgomery and Prince George’s will have to kick in more money, Hogan said. It will be hard for them to decline after saying for years what an economic plus the Purple Line would be.

“That puts this squarely in the lap of the counties, who have gone on record on how much they want this,” Greater Washington Board of Trade President James C. Dinegar said.

At Rahn’s request, Leggett has expressed willingness to contribute up to $50 million more to the project. But Prince George’s County Executive Rushern L. Baker III (D), who hasn’t yet talked to Rahn about it, said that would be too much for his county, which is less affluent and which soundly rejected his recent proposal to raise property taxes to benefit public schools.

“My gut reaction is . . . we don’t have $50 million,” Baker said. “And I can’t see the council going along with” such a large additional funding commitment.

As he has done elsewhere in Annapolis, Hogan pushed Rahn to aggressively cut costs associated with the Purple Line. Rahn got in the habit of saying the goal was to produce “a Chevy product” rather than “a Cadillac.”

In perhaps the biggest change, the plan now is to reduce the frequency of the service so the two-car trains run every seven and a half minutes instead of every six minutes as planned.

Hogan also is asking whatever private company wins the right to construct the line to find ways to reduce costs beyond what Rahn has trimmed. And he wants the private sector to pick up a bigger share of the financing.

The governor spent a lot of time with spreadsheets comparing ridership projections with those of other light-rail lines. He repeatedly told Rahn and others that he thought some of the forecasts for job creation along the Purple Line’s route were exaggerated.

As a result, backers who lobbied both Hogan and Rahn adjusted their pitches.

In particular, Leggett and Baker said they made a point of respecting Hogan’s skepticism when they met with him on May 21 to make a final push for the project.

The two surprised Hogan by acknowledging that the project wasn’t a “silver bullet” for their counties’ economies.

Leggett said he couldn’t give the Purple Line an “A-plus” rating, but only a “solid B” or “B-plus.” But even if the Purple Line generated only half the number of jobs that were projected, Leggett said, it was still worth doing.

That was especially true given that the federal government has recommended picking up $900 million of the cost, Leggett said.

“At a time when you have fewer federal dollars being given, when you can’t even get a transportation bill through Congress . . . a B or B-plus in that environment is good,” Leggett said.

Likewise, business leaders began arguing that even if the governor didn’t believe that the Purple Line would spur development to add tens of thousands of new jobs, he should accept that workers in Prince George’s and Montgomery need the line — which will connect four Metro stations and cross an area not served by Metrorail — to get to jobs that already exist.

By the end, Hogan was swayed enough that some of his comments echoed what backers have been saying all along. “We saw a lot of the benefits of it, with respect to economic development, job creation,” Hogan said. “There’s no question in my mind that it’s going to be worthwhile long-term.”

Hogan also was impressed by data indicating that residents of the Washington suburbs were more likely to use transit than residents in Baltimore. The Purple Line “will be built in a part of our state that has demonstrated strong support and use of mass transit,” he said.

It wasn’t clear exactly when Hogan made up his mind.

“It’s not like there was a moment when he sort of raised his finger in the air and shouted, ‘Eureka!’” said Matthew A. Clark, Hogan’s communications director.

Rahn says he pressed Hogan about the decision during their recent trade mission to Asia, which included a ride on a high-speed Japanese maglev train.

“I would pester him, and he would rib me,” Rahn said. “There would be opportunities to comment on purple-colored things.”

When they returned from the trip in early June, Hogan had another, more personal challenge to deal with: He had found a tumor in his neck and was undergoing tests that eventually would show he had advanced non-Hodgkin’s lymphoma, a type of cancer.

Having promised a Purple Line decision by the end of June, Hogan spent the next two weeks juggling doctors’ visits and his regular work duties with the never-ending spreadsheets.

He announced his diagnosis on Monday and called Rahn on Tuesday evening to tell him his Purple Line decision.

The news conference was scheduled for Thursday. There were multiple charts on display to explain the nearly $2 billion in new roads funding, which Hogan discussed in great detail before turning his attention to light-rail.

There were no charts about the Purple Line. But the governor wore a purple necktie, which he later said was chosen to offer a coy hint that he was not killing the project.