Roberto Firmino put the Reds ahead from the penalty spot, but Inaki Williams cancelled it out for the La Liga side before the break.
However, youngsters Ben Woodburn and Dominic Solanke both struck in the second half to ensure Jürgen Klopp's side's final friendly ended in a win.