The stock market has struggled this month as investors worried that persistently high oil prices will drive up costs and dampen consumer spending.