After posting a loss of $4.2 billion for fiscal 2012, Falls Church-based Computer Sciences Corp. is beginning to show signs of recovery. Last week, the technology giant said it moved back into the black, and the company boosted its financial projections for the year.

Mike Lawrie, who took over last year as chief executive of CSC, has been trying to turn around the contractor by cutting costs, bringing in new leadership and divesting businesses the company no longer wants.

“We’re doing what we said we would do, and we’re making good progress,” said Paul N. Saleh, CSC’s chief financial officer, in an interview last week. “That’s what is getting the attention of folks.”

CSC reported a profit of $513 million ($3.27 per share) for the three months ended Dec. 28, up from a loss of nearly $1.4 billion ($8.96) in the same period a year earlier.

The company’s stock closed at $45.94 a share Thursday, marking a nearly $20 increase from a share price of $26.48 a year earlier.

“I would . . . argue the turnaround is performing better and faster than we expected,” said Tien-tsin Huang, senior equity analyst for computer services at J.P. Morgan, which has a business relationship with CSC.

The company’s rebound could provide lessons for a contracting industry that’s being forced to pivot as government spending declines. But the same turbulence could undermine the improvements at CSC, which derives about one-third of its revenue from the U.S. government. (The rest comes from the commercial sector and foreign governments.) The company is also facing a Securities and Exchange Commission investigation into its accounting.

Lawrie said in a call with analysts last week that CSC has made progress in winning more work in growth areas such as cloud computing and cybersecurity.

The company has sold off multiple businesses, including the $1 billion sale of its credit services business to Equifax.

It also divested Paxus, a staffing business in Australia, and pieces of its business solutions and services unit in Italy.

Lawrie said CSC is reducing its layers of management to eight from roughly 13.

“It’s just good old-fashioned management attention,” Lawrie told analysts. “That’s what we’re doing with much greater vigor and discipline, and that has been the bulk of the improvement that we have seen so far this year.”

CSC raised its forecast for the year, moving its target earnings per share from continuing operations to a range of $2.50 to $2.70, up from a previous target of $2.30 to $2.50.

Still, the company is not out of the woods. CSC remains under investigation by the SEC for possible errors within the company unit that manages information technology services for government agencies and commercial clients.

At the same time, the company’s government work faces significant uncertainty, given the threat of sequestration and other spending cuts.

“Balancing [the fiscal uncertainty] with restructuring and focusing on growth — that’s a lot of balls to juggle” for CSC, Huang said.

But Saleh said CSC still sees plenty of opportunities to win new work, particularly in the commercial sector.

And Lawrie said last week that CSC is beginning to look toward the switch from cost-cutting to adding revenue.

“We’re putting more salespeople in place. We’re putting some of the sales tools and processes in place,” Lawrie told analysts. “We’re beginning to look at some geographies [where] we think there’s some good growth opportunities, most notably Asia and parts of Latin America, and even the United States.”