Halliburton Co.'s first-quarter earnings rose 23% as the company continued to benefit from rig activity in oil-rich basins, though margins declined.

Halliburton—the second-largest oil-field-services company after Schlumberger Ltd.—on Wednesday reported a profit of $627 million, or 68 cents a share, up from $511 million, or 56 cents, a year earlier. Excluding items, earnings from continuing operations rose to 89 cents from 61 cents. Revenue jumped 30% to $6.87 billion.

Analysts...