This paper considers the portfolio selection and capital injection problem for a diffusion risk model within the classical Black–Scholes financial market. It is assumed that the original surplus process of an insurance portfolio is described by a drifted Brownian motion, and that the surplus can be invested in a risky asset and a risk-free asset. When the surplus hits zero, the company can inject capital to keep the surplus positive. In addition, it is assumed that both fixed and proportional costs are incurred upon each capital injection. Our objective is to minimize the expected value of the discounted capital injection costs by controlling the investment policy and the capital injection policy. We first prove the continuity of the value function and a verification theorem for the corresponding Hamilton–Jacobi–Bellman (HJB) equation. We then show that the optimal investment policy is a solution to a terminal value problem of an ordinary differential equation. In particular, explicit solutions are derived in some special cases and a series solution is obtained for the general case. Also, we propose a numerical method to solve the optimal investment and capital injection policies. Finally, a numerical study is carried out to illustrate the effect of the model parameters on the optimal policies.