Slow earthquakes are observed beneath the seismogenic zone. The rock consisting the Earth is frequently modeled as a Maxwell fluid which behaves elastically only when it deforms at a time scale which is sufficiently short compared to the relaxation time scale. However, it still remains unclear how the seismicity changes with these brittle/ductile and elastic/viscous transition. Here, we perform shear deformation experiments using quasi-Maxwell fluid under different strain rates, and show that the same material can cause earthquakes associated with elastic rebound as well as viscous flow. Around the threshold, both earthquakes in which ruptures propagate at a shear wave velocity and viscous relaxation occur simultaneously.