Ford's second-quarter earnings have beaten analyst expectations, helped by strong truck sales in North America.