Microsoft is buying Nokia's line-up of smartphones and a portfolio of patents and services in an attempt to strengthen its fight with Apple and Google to capture a slice of the lucrative mobile computing market.