The South Korean technology giant posted stronger-than-expected first-quarter profit, as solid gains in its smartphone segment offset weak earnings at its core semiconductor business.