Per @SKRX's suggestion, another solution is provided below.
For simplicity, we assume that the stock price process $\{S_t \mid t \geq 0\}$ follows an SDE, under the risk-neutral measure $\mathbb{Q}$, of the form
\begin{align*}
\frac{dS_t}{S_t} = r dt + \sigma dW_t,
\end{align*}
where $r$ is the constant interest rate, $\sigma$ is the constant volatility, and $\{W_t \mid t \geq 0\}$ is a standard Brownian motion. Moreover, let $B_t = e^{rt}$ be the money-market account value at time $t$.
Note that
\begin{align*}
(S_T-K)^+ &= (S_T-K)\mathbb{1}_{S_T >K}\\
&= S_T\mathbb{1}_{S_T >K} - K \mathbb{1}_{S_T >K}.
\end{align*}
Then,
\begin{align*}
e^{-rT} \mathbb{E}_{\mathbb{Q}}\big((S_T-K)^+ \big) &=e^{-rT}\mathbb{E}_{\mathbb{Q}}\big(S_T\mathbb{1}_{S_T >K}\big) - K e^{-rT}\mathbb{Q}(S_T >K)\\
&=e^{-rT}\mathbb{E}_{\mathbb{Q}}\big(S_T\mathbb{1}_{S_T >K}\big) - K e^{-rT}N(d_2).
\end{align*}
To compute the expectation $\mathbb{E}_{\mathbb{Q}}\big(S_T\mathbb{1}_{S_T >K}\big)$, we define the probability measure $\widetilde{\mathbb{Q}}$, so that we have the Radon-Nikodym derivative of the form
\begin{align*}
\frac{d\widetilde{\mathbb{Q}}}{d\mathbb{Q}}\big|_t &= \frac{S_t}{B_t S_0}\\
&=\exp\left(-\frac{\sigma^2}{2} t + \sigma W_t \right).
\end{align*}
By Girsanov theorem, $\{\widetilde{W}_t \mid t \geq 0\}$, where
\begin{align*}
\widetilde{W}_t = W_t - \sigma t,
\end{align*}
is a standard Brownian motion under the probability measure $\widetilde{\mathbb{Q}}$. Moreover, under $\widetilde{\mathbb{Q}}$,
\begin{align*}
\frac{dS_t}{S_t} = \left(r+ \sigma^2 \right) dt + \sigma d\widetilde{W}_t.
\end{align*}
Note also that
\begin{align*}
\frac{d\mathbb{Q}}{d\widetilde{\mathbb{Q}}}\big|_t &= \frac{B_tS_0}{S_t}.
\end{align*}
Therefore,
\begin{align*}
e^{-rT}\mathbb{E}_{\mathbb{Q}}\big(S_T\mathbb{1}_{S_T >K}\big) &=e^{-rT}\mathbb{E}_{\widetilde{\mathbb{Q}}}\left(\frac{d\mathbb{Q}}{d\widetilde{\mathbb{Q}}}\big|_T S_T\mathbb{1}_{S_T >K}\right)\\
&=S_0 \widetilde{\mathbb{Q}}(S_T >K)\\
&=S_0 N(d_1).
\end{align*}
That is,
\begin{align*}
e^{-rT} \mathbb{E}_{\mathbb{Q}}\big((S_T-K)^+ \big)
&= S_0 \widetilde{\mathbb{Q}}(S_T >K) - K e^{-rT}\mathbb{Q}(S_T >K) \\
&= S_0 N(d_1) - K e^{-rT}N(d_2),
\end{align*}
which is the Black-Scholes formula.