Lockheed Martin, the world’s largest defense contractor, easily weathered government spending cuts during its most recent quarter, reporting a 20 percent jump in profit Tuesday and raising its earnings expectations for the year.

Like many defense contractors, Lockheed has been grappling with declining sales to its main customer — the Pentagon. To offset the sales drop, the Bethesda-based contractor continues to shrink its workforce, helping to lift its profits.

Lockheed warned earlier this year that automatic spending cuts included in the sequester would cost the firm about $825 million. But Bruce L. Tanner, the contractor’s chief financial officer, told reporters Tuesday that the impact has been about half that.

The recent government shutdown, which was not included in the company’s earnings report, cost Lockheed about $15 million to $20 million per week, he added.

The shutdown hurt employees, he said, “but [did] not — from a scale perspective — [have] all that significant an impact to Lockheed Martin Corp.” The company furloughed about 2,400 workers during the two-week budget impasse.

The company’s stock jumped nearly 4 percent Tuesday to about $130 a share.

Lockheed’s robust profits — $873 million during the third quarter compared with $727 million for the same quarter last year — came despite continuing declines in revenue.

Revenue fell to $11.3 billion in the three-month period ended Sept. 29, down 4.3 percent from the same period a year earlier.

Sales declined in all but one of the company’s five units. The information technology unit, which has struggled in recent months, saw sales and profit decline by about 10 percent during the quarter.

Information technology spending is “an area that the government can cut back on pretty readily,” Marillyn A. Hewson, Lockheed’s chief executive, said in a call with analysts Tuesday.

Only Lockheed’s missiles and fire-control unit reported a small boost in revenue.

Lockheed said it expects next year’s sales to be even lower, and Tanner said the company continues to prepare. Last week, the contractor announced that it was cutting 600 employees in its District-based mission systems and training unit. Few of those layoffs are expected to hit locally.

Government spending declines will eventually take a toll on all contractors, but it will take time because so many military programs are booked well in advance, said Loren Thompson, a defense industry consultant who advises Lockheed and many of its competitors.

“It’s hard to keep profits high when you’ve only got one customer and that customer is buying less,” he said.

Defense giants General Dynamics and Northrop Grumman are scheduled to report earnings Wednesday. They have both previously reported results similar to Lockheed’s — declining sales but higher profits.