Home prices kept rising in July across the United States, buoyed by greater sales and fewer foreclosures.

National home prices increased 1.2 percent in July, compared to the same month last year, according to the Standard & Poor’s/Case Shiller index released Tuesday. That’s the second straight year-over-year gain after two years without one.

The report also says prices rose in July from June in all 20 cities tracked by the index. That’s the third straight month in which prices rose in every city.

Steady price increases and record-low mortgage rates are helping drive a housing recovery.

In the 12 months ending in July, prices have risen in 16 of 20 cities. In Phoenix, one of the cities hardest hit by the housing bust, prices are up 16.6 percent in that stretch. Prices in Minneapolis and Detroit have risen more than 6 percent.

“We are more optimistic about housing,” David Blitzer, chairman of the S&P’s index committee. “Stronger housing numbers are a positive factor for other measures, including consumer confidence.”

Prices fell from a year earlier in Atlanta, Chicago, New York and Las Vegas.

The S&P/Case-Shiller index covers roughly half of U.S. homes. It measures prices compared with those in January 2000 and creates a three-month moving average. The July figures are the latest available.

Home prices are still 30 percent below their peak in June 2006, according to Case-Shiller. That was the height of the housing boom.

Other measures of home prices are also showing steady gains. CoreLogic, a private real estate data provider, said earlier this month that prices rose in July from a year earlier by the most in six years. And a federal government housing agency has also reported annual increases.

Rising home prices are one of many signs that the housing market is slowly recovering.

Sales of previously occupied homes jumped in August to the highest level since May 2010. Builder confidence is at a six-year high and construction of single-family homes rose last month to the fastest annual rate in more than two years. Even with the gains, home sales and construction remain well below healthy levels.

The broader economy is likely to benefit from rising home prices. When home prices rise, people typically feel wealthier and spend more. And more Americans are likely to put their houses up for sale, which could further energize the market.

Home sales have been bolstered by the lowest mortgage rates on record. The average rate on the 30-year fixed mortgage touched a record low of 3.49 percent last week and has been below 4 percent all year. A limited supply of homes has also helped drive prices higher.

Prices are also rising because of a decline in foreclosures and sales of other deeply discounted homes. Many homes in the foreclosure process will likely come on the market in the coming months, which could drag on prices.

Still, many Americans, particularly first-time homebuyers, are unable to qualify for a mortgage or can’t afford larger down payments required by banks. That’s holding back sales.

Home sales could get a further boost from the Federal Reserve. The Fed said two weeks ago that it would purchase $40 billion of mortgage-backed securities each month until the economy and hiring improve substantially. That’s likely to keep mortgage rates at record-low rates for some time.