U.S. stock indexes finished with tiny gains Wednesday as retailers jumped after a strong hiring forecast from Target and energy companies rose along with oil prices.

Companies that sell everything from clothing to electronics rose after Target said it will hire 100,000 workers for the holiday season,…