McAfee Inc, the No. 2 security software maker, reported better-than-expected profit on Thursday, lifted by growth in its consumer business.

While warning of significant headwinds due to the impact of foreign exchange, the company set a forecast for the current quarter that was in line with Wall Street estimates.

McAfee shares rose slightly in after-hours trading on Thursday.

McAfee said demand for personal computers remains strong, and Chief Executive Dave DeWalt said the economic climate continues to improve.

I see continued improvement in the macroeconomic conditions for IT. We have seen multiple successive quarters of improvement in spending, in most segments worldwide, he told analysts on a conference call.

The company reported net earnings for the fiscal second quarter ended June 30 of $39.4 million, or 25 cents a share, up from $28.7 million, or 18 cents a share, in the year-ago period.

Excluding items, McAfee posted a profit of 63 cents a share, beating the average analyst estimate of 60 cents a share, according to Thomson Reuters I/B/E/S.

Revenue rose 4 percent to $489.2 million, while non-GAAP revenue came in at $495.3 million. Wall Street was targeting sales of $507.4 million.

McAfee said it deferred more revenue than normal in the quarter, mainly due to fallout from a glitch in the company's ant-virus software, a problem it revealed in April.

The company's consumer business grew 8 percent, while the corporate business rose 5 percent. Growth in North America and Asia-Pacific was strong, while sales in Europe fell slightly.

McAfee forecast earnings for the current quarter, excluding items, of 62 to 66 cents a share, on revenue of $505 million to $520 million.

Wall Street is expecting earnings of 65 cents a share on revenue of $523 million.

Separately, McAfee said it has agreed to acquire privately held tenCube, provider of the WaveSecure mobile security service. Financial terms of the deal were not disclosed.

On Wednesday, McAfee rival Symantec Corp, the world's No. 1 security software maker, warned that second-quarter sales and profit would likely miss Wall Street estimates.

Shares of McAfee rose less than 1 percent to $30.50 in extended trading after closing at $30.25 on the New York Stock Exchange.

(Reporting by Gabriel Madway, editing by Matthew Lewis)