Target posted better-than-expected second-quarter sales and raised its full-year outlook.