A spike in gas prices contributed to Los Angeles-area consumer prices rising substantially faster than the nation as a whole in July, according to new federal data.