Two of the world's petroleum giants -- Exxon Corp. and Standard Oil Co. of Indian (Amoco) -- reported yesterday that second-quarter profits rose sharply, as Wall Street analysts had forecast.

The increase, of 21 percent and 36 percent, respectively, came during a period of long lines at gasoline stations and calls in Washington for a tax on so-called "windfall" oil industry profits.

Both companies, however, attributed the recent gains primarily to higher earnings from operations overseas and not from business in this country.

Exxon Christian Clifton Garvin Jr. said that costs in the United States have risen "much more than selling prices" during 1979, actually reducing his firm's domestic refinery and marketing profits for he recent period to less than one-half those in the second quarter of last year.

Exxon, based in New York, reported second-quarter profits rose 21 percent to $830 million (1.39 billion (3.10), and revenues rose 25 percent to $38.4 billion. The higher rate of growth in earnings for the six-month period reflects a higher rate of profits in the first three months than for the second quarter at Exxon, the largest petroelum company in the world.

Standard Oil of Indians said second-quarter profits rose 36 percent to $401.2 million ($2.74 a share) from $294.2 million ($2.01) a year earlier as revenues gained 14 percent to $4.6 billion.

In the first half of 1979, the Chicago firm earned $750.3 million ($5.13), up 32 percent from $567.7 million ($3.88) a year earlier. Revenues increased by 15 percent to $9 billion for Standard, the nation's sixth-largest petroleum firm.

Standard Chairman John Swearingen said that almost 70 percent of the first-half increase in earings came from foreign petroleum and worldwide chemical operations. Unlike Exxon, however, Amoco did report higher profits from domestic petroleum operations -- up 16 percent in the first six months to $425 million.

Exxon's earnings from petroleum and natural gas operations in the U.S. were down 5 percent from last year to $378 millon, partly because of higher exploration costs. Commenting on the lower domestic profits, Garvin said: "It is hoped that we will soon have a period of stability in imported crude oil costs so that, with reasonable regulatory measures at home, we can, in the near future, again earn a satifactory return on the investmemt of about $2.7 billion Exxon has in U.S. refining and marketing properties."

Despite the domestic downturn, however, the rate of return on capital for Exxon in the first six months rose to $13.8 percent from 11.7 percent in the 1978 period. One analyst, Eugene Nowak of Blyth Eastman Dillon, suggested that Exxon may have written off some part or all of its $343 million investment in leases and drilling in the disappointing Baltimore Canyon area off the East Coast, Associated Press said.

Several unusual items affected Exxon's second-quarter results. Foreign exchange translation resulted in a loss of $33 million compared with a $22 million gain in the second quarter last year. The decission by oil-producing nations to boost prices, retroactive to June 1, cut profits by another $100 million because the "unforeseen cost increase" was not reflected in higher sales. Exxon is a major buyer of oil from Saudi Arabia, which boosted prices by $3.45 a barrel to $18.

Offsetting these charges, in part, Exxon had a one-time gain of $70 million fom depletion of lower-cost inventories, which Garvin said may not be replenished soon because of tight supplies.

Overseas, Exxon reported, sixmonth foreign exploration and production earnings increased 1 percent to $750 million, while refining and marketing operations brought in earings of $342 million compared with $174 million a year ago. Worldwide chemical earnings rose 76 percent to$217 million.

Garvin said Exxon's spending for exploration and new facilities rose 6 percent in the first six months to $2.6 billion, with about 40 percent of the outlays in this country. Development of energy resources -- oil, gas, coal, uranium, solar and other alternates -- accounted for $1.85 billion of the spending.

Amoco's capital and exploration expenses for the first six months rose 16 percent to $1.2 billion, with U.S. spending accounting for $766 million. A record $565 million was devoted to finding and developing domestic supplies of curde oil and natural gas, up 19 percent from the same period a year earlier.

Pennzoil C. also reported sharply hihgher profits in the second quarter. Net income was $58 million ($1.72) a share) compared with $30.7 million (89 cents), as sales rose to $493 million from $376.5 million, the Houston company said yesterday. Last week, Occidental Petroleum and Amerada Hess Corp. posted higher earnings for the recent quarter. CAPTION: Chart, Big Oil Profits, By Alice Kresse -- The Washington Post