A virtual X-Ray Laboratory for Materials Science and Engineering has been developed and used as a flexible and powerful tool to help undergraduate and graduate students become familiar with the design and operation of the X-ray equipment in visual and interactive ways in order to learn fundamental principles underlying X-ray analytical methods. The virtual equipment and lab assignments have been used for: (i) authentic online experimentation, (ii) homework and control assignments with traditional and blended courses, (iii) preparing students for hands-on work in physical X-ray labs, (iv) lecture demonstrations, and (v) performance-based assessment of students’ ability to apply gained theoretical knowledge for operating actual equipment and solving practical problems. Students have also used the virtual diffractometer linked and synchronized with an actual powder diffractometer for blended experimentation. Using the associated learning and content management system (LCMS) and authoring tools, instructors kept track of students’ performance and designed new virtual experiments and more personalized learning assignments for students. The lab has also been integrated with the MITx course available on the massive open online course edX platform for Massachusetts Institute of Technology for undergraduate students.