In quantum systems, coherent superpositions of electronic states evolve on ultrafast time scales (few femtoseconds to attoseconds; 1 attosecond = 0.001 femtoseconds = 10-18 seconds), leading to a time-dependent charge density. Here we performed time-resolved measurements using attosecond soft x-ray pulses produced by a free-electron laser, to track the evolution of a coherent core-hole excitation in nitric oxide. Using an additional circularly polarized infrared laser pulse, we created a clock to time-resolve the electron dynamics and demonstrated control of the coherent electron motion by tuning the photon energy of the x-ray pulse. Core-excited states offer a fundamental test bed for studying coherent electron dynamics in highly excited and strongly correlated matter.