This paper addresses the issue of how to suppress the spread of computer virus by means of the optimal control method. First, a controlled delayed computer virus spread model is established. Second, an optimal control problem is formulated by making a tradeoff between the control cost and the control effect. Third, the optimal control strategies are theoretically investigated. Finally, it is experimentally shown that the spread of infected nodes can be suppressed effectively by adopting an optimal control strategy.