Focusing light into opaque random or scattering media such as biological tissue is a much sought-after goal for biomedical applications such as photodynamic therapy, optical manipulation, and photostimulation. However, focusing with conventional lenses is restricted to one transport mean free path in scattering media, limiting both optical penetration depth and resolution. Focusing deeper is possible by using optical phase conjugation or wavefront shaping to compensate for the scattering. For practical applications, wavefront shaping offers the advantage of a robust optical system that is less sensitive to optical misalignment. Here, the phase of the incident light is spatially tailored using a phase-shifting array to pre-compensate for scattering. The challenge, then, is to determine the phase pattern which allows light to be optimally delivered to the target region. Optimization algorithms are typically employed for this purpose, with visible particles used as targets to generate feedback. However, using these particles is invasive, and light delivery is limited to fixed points. Here, we demonstrate a method for non-invasive and dynamic focusing, by using ultrasound encoding as a virtual guide star for feedback to an optimization algorithm. The light intensity at the acoustic focus was increased by an order of magnitude. This technique has broad biomedical applications, such as in optogenetics or photoactivation of drugs.