Price increases and cost discipline helped the audiostreaming giant pivot from heavy spending on growth to sustained profits.