Currently available quantum hardware allows for small scale implementations of quantum machine learning algorithms. Such experiments aid the search for applications of quantum computers by benchmarking the near-term feasibility of candidate algorithms. Here we demonstrate the quantum learning of a two-qubit unitary by a sequence of three parameterized quantum circuits containing a total of 21 variational parameters. Moreover, we variationally diagonalize the unitary to learn its spectral decomposition, i.e., its eigenvalues and eigenvectors. We illustrate how this can be used as a subroutine to compress the depth of dynamical quantum simulations. One can view our implementation as a demonstration of entanglement-enhanced machine learning, as only a single (entangled) training data pair is required to learn a 4x4 unitary matrix.