Spain beat Germany 2-1 to match Italy with a record fifth title at the Under-21 European Championship on Sunday.