By Xavier Fontdegloria

Business activity in the U.S. private sector improved for a second consecutive month in June, but remained in contraction territory, as the country continued to reopen while trying to contain the coronavirus pandemic, preliminary results from IHS Markit data showed Tuesday.

The flash reading for the U.S. Composite Output Index was 46.8 in June, up from the 37.0 registered in May. This is the second consecutive month of improvement and a four-month high, after April's record-breaking low of 27.0 at the height of the coronavirus pandemic. The decrease registered in June was the softest since February, when the pandemic escalated.

The indicator is based on data from the firm's PMI surveys for manufacturing and services sectors. An index reading above 50 indicates expansion, while below 50 it signals contraction.

"U.S. private sector firms signalled a notable slowdown in the rate of output contraction in June, as businesses began to reopen on a larger scale. Manufacturers and service providers alike registered much softer declines in output compared to May," IHS Markit said.

The improvement of the PMI data will fuel hopes that the economy can return to growth in the third quarter, Chris Williamson, IHS Markit chief business economist, said in prepared remarks.

"However, although brief, the downturn has been fiercer than anything seen previously, leaving a deep scar which will take a long time to heal," Mr. Williamson said.

IHS Markit's flash U.S. Services Business Activity Index was 46.7 for June, up from 37.5 in May. The pace of contraction eased substantially as increasing numbers of service providers returned to work, IHS Markit said. Economists polled by Dow Jones expected a similar reading of 48.0.

IHS Markit's two flash indexes measuring manufacturing also grew, data showed.

The company said its flash U.S. Manufacturing PMI was 49.6 in June compared with 39.8 May's reading. The figure indicates only a fractional deterioration in operating conditions, as it posted only slightly below the 50.0 no-change mark, IHS Markit said.

Economists expected the U.S. Manufacturing PMI flash reading to be at a higher level of 52.0.

The flash U.S. Manufacturing Output Index was 47.8 in June, up from 34.4 in May.

"Any return to growth will be prone to losing momentum due to persistent weak demand for many goods and services, linked in turn to ongoing social distancing, high unemployment and uncertainty about the outlook, curbing spending by businesses and households," Mr. Williamson said.

Write to Xavier Fontdegloria at xavier.fontdegloria@wsj.com