Italian confectionery giant Ferrero is to buy a majority stake in a Spanish ice cream business, it has confirmed.