Spanish league: Barcelona win late to end poor run, Madrid held by Elche