Wavefront distortion in scattering media can be compensated for using optical wavefront shaping. In this technique, a spatial light modulator (SLM) is used to apply a spatially distributed phase shift to the optical field. A genetic optimization algorithm was used to obtain the SLM pattern which best focuses light within the medium. The target volume is defined by using a focused ultrasound beam to encode light travelling within the acoustic focus. The ultrasonically-encoded light is measured and used as feedback to the algorithm, which then searches for the pattern which maximizes the encoded light intensity. We call this technique ultrasonically-encoded wavefront shaping (SEWS). Using SEWS, we focused light into a scattering medium consisting of ground glass diffuser and a gelatin phantom. The optical intensity at the target was increased by 11 times over the original intensity. These results were validated using fluorescent imaging at the ultrasonic focus.