Optimal laser control for ultrafast selection of closely lying excited states whose energy separation is smaller than the laser bandwidth is reported on the two-photon transition of atomic cesium; Cs(6S-->7D(J), J=5/2 and 3/2). Selective excitation was carried out by pulse shaping of ultrashort laser pulses which were adaptively modulated in a closed-loop learning system handling eight parameters representing the electric field. Two-color fluorescence from the respective excited states was monitored to measure the selectivity. The fitness used in the learning algorithm was evaluated from the ratio of the fluorescence yields. After fifty generations, a pair of nearly transform-limited pulses were obtained as an optimal pulse shape, proving the effectiveness of the "Ramsey fringes" mechanism. The contrast of the selection ratio was improved by approximately 30% from the simple "Ramsey fringes" experiment.