Both figures were stronger than Wall Street analysts had expected.
At last check Western Digital shares were 10% higher at $58. They'd finished the regular Thursday trading session down 1% at $52.65.
For the quarter ended Jan. 1, the San Jose, Calif., company earned 20 cents a share, compared with a loss of 47 cents in the year-earlier quarter. The latest adjusted earnings were 69 cents a share.
Revenue fell to $3.94 billion from $4.23 billion.
A survey of analysts by FactSet produced consensus estimates for the quarter of a GAAP net loss of 20 cents a share, or an adjusted profit of 54 cents, on revenue of $3.88 billion.
“During the quarter, we captured strength in the retail business and also delivered on our target outcome to complete qualification of our energy-assisted hard drives and second-generation enterprise [solid-state drive] products with some of the world’s largest data center operators," Chief Executive David Goeckeler said in a statement.
"While there is still more work to be done, we remain extremely focused on meeting the needs of our customers and ramping our next-generation products throughout calendar 2021.”
For the fiscal third quarter, Western Digital estimates adjusted earnings of 55 cents to 75 cents a share on revenue ranging $3.85 billion to $4.05 billion.
The FactSet survey is calling for adjusted profit of 63 cents a share on revenue of $3.86 billion.