The Hubbard model underlies our understanding of strongly correlated materials. While its standard form only comprises interaction between particles at the same lattice site, its extension to encompass long-range interaction, which activates terms acting between different sites, is predicted to profoundly alter the quantum behavior of the system. We realize the extended Bose-Hubbard model for an ultracold gas of strongly magnetic erbium atoms in a three-dimensional optical lattice. Controlling the orientation of the atomic dipoles, we reveal the anisotropic character of the onsite interaction and hopping dynamics, and their influence on the superfluidto-Mott insulator quantum phase transition. Moreover, we observe nearest-neighbor interaction, which is a genuine consequence of the long-range nature of dipolar interactions. Our results lay the groundwork for future studies of novel exotic many-body quantum phases. PACS numbers: 67.85.Hj, 37.10.De, 51.60.+a, 05.30.Rt Dipolar interactions, reflecting the forces between a pair of magnetic or electric dipoles, account for many physically and biologically significant phenomena. These range from novel phases appearing at low temperatures in quantum many-body systems [1,2], liquid crystals and ferrofluids in soft condensed matter physics [3,4], to the mechanism underlying protein folding [5]. The distinguishing feature of dipole-dipole interactions (DDI) is their long-range and anisotropic character [6]: a pair of dipoles oriented in parallel will repel each other, while the interaction between two head to tail dipoles will be attractive. While remarkable progress has been made with gases of polar molecules [7] and Rydberg ensembles [8] comprising electric dipoles, it is the recent experimental advances in creating quantum degenerate gases of bosonic and fermionic magnetic atoms, including Cr [9-11] and the Lanthanides Er [12] and Dy [13], which have now opened the door to a study of magnetic dipolar interactions, and their unique role in Hubbard dynamics of a quantum lattice gas.Ultracold Lanthanide atoms with their open electronic fshells, and their anisotropic interactions are characterized by unconventional low energy scattering properties, including the proliferation of Feshbach resonances [14]. This complexity of Lanthanides manifests itself in quantum many-body dynamics: by preparing quantum degenerate Lanthanide gases in optical lattices we realize extended Hubbard models for bosonic and fermionic atoms. Here, in addition to the familiar single particle tunneling and isotropic onsite interactions (as for contact interactions in Alkali) dipolar interactions give rise to anisotropic onsite and nearest-neighbor (offsite) interactions (NNI), and density-assisted tunneling (DAT) [15]. Such extended Hubbard models have been studied extensively in theoretical condensed matter physics and quantum material science [16,17], and it is the competition between these unconventional Hubbard interactions, which underlies the prediction of exotic quantum phases such as super...