Investors looking to cushion their portfolios against inflation helped real-estate stocks lead the S&P 500 in recent weeks. The real-estate sector, which focuses on companies that rent properties, has gained 14% this quarter, more than double the 6.9% gain of the broader stock index.