We propose a novel method for the classification of EEG signals during motor-imagery. For motor-imagery based brain computer interface (MI-BCI), a method called common spatial pattern (CSP), which finds spatial weights for electrodes, is effective, however CSP needs bandpass filtering as preprocessing. This paper addresses the problem to find parameters of the filter as well as the spatial weights. The filter is parameterize as weights for frequency spectra. Finding the optimal parameters is formulated as a constraint minimum variance problem. Then, the spatial and frequency weights are sought by alternately solving the generalized eigenvalue problem, and the cost function monotonically decreases by the alternative optimization. In our experiment of MI-BCI, the proposed method achieved maximum improvement by 6% in the classification accuracy over conventional methods.