Liverpool secured an important victory in their hunt for Champions League qualification.