Bryan Ruiz headed home the only goal just before the break as Costa Rica upset Italy to book a place in the Round of 16 and eliminate England.