An experimental setup to measure the effects of a high magnetic field on the structure and decay dynamics of molecules is designed and constructed. A vacuum chamber is mounted in the bore of a superconducting magnet. A molecular beam passes in the chamber. Pulsed laser light excites the molecules in the field. The parent or fragment ions are extracted by an electric field parallel to the magnetic field. They are detected by a microchannel plate. Their mass and charge are determined by the time-of-flight method. The performance of the setup was examined using resonance-enhanced two-photon ionization through the X(2) Π-A(2)Σ(+) transition of nitric oxide (NO) molecules. The ions were detected with sufficient mass resolution to discriminate the species in a field of up to 10 T. This is the first experiment to succeed in the mass-selective detection of ions by the time-of-flight method in a high magnetic field. By measuring NO(+) ion current as a function of the laser frequency, the X(2)Π-A(2) Σ(+) rotational transition lines, separated clearly from the background noise, were observed in fields of up to 10 T. From the relative strengths of the transition lines, the ion detection efficiency was determined as a function of the magnetic field strength. This setup was shown to be applicable in a field higher than 10 T. The Landau levels of molecules were successfully observed to demonstrate the setup.