Consider the space $B([a,b])$ of bounded Borel functions. We will endow it locally convex topology. Let $M([a,b])$ be a Banach space of complex-valued Borel measures on $[a,b]$. For each $\mu\in M([a,b])$ we define a semi-norm $ \Vert\cdot\Vert_\mu:B([a,b])\to\mathbb{R}_+: f\mapsto \int\limits_{[a,b]}f(t)d\mu(t). $ The family $\{\Vert\cdot\Vert_\mu:\mu\in M([a,b])\}$ gives rise to some Hausdorff locally convex topology on $B([a,b])$. We will denote this space $(B([a,b]),wm)$.Consider $\mathcal{B}(H)$ with weak operator topology and denote this space $(\mathcal{B}(H),wo)$.
A continuous $*$-homomorphism $\gamma_{b,T}:(B([a,b]),wm)\to(\mathcal{B}(H),wo)$ such that $\gamma_{b,T}(id_{[a,b]})=T$ is called Borel functional calculus of operator $T$.
Theorem There exist unique Borel functional calculus $\gamma_{b,T}:(B([a,b]),wm)\to(\mathcal{B}(H),wo)$. Moreover this is contractive involutive homomorphism of involutive algebras which extends continuous calculus on $[a,b]$.
Denote $H=L^2(X,\mu)$. Since $\varphi\colon X\to\mathbb{R}$ is a bounded measurable function then $T$ is a bounded selfadjoint operator. Hence $\sigma(T)\subset\mathbb{R}$. Since $T$ is selfadjoint then there exist some interval $[a,b]$ such that $\sigma(T)\subset[a,b]$. Now let $\gamma_{b,T}$ be the Borel functional calculus on $[a,b]$ then we can define spectral measure by the following procedure. For each Borel set $A\subset [a,b]$ we define its spectral measure $E(A)$ by equality $ E(A)=\gamma_{b,T}(1_{A\cap[a,b]}). $ where $1_{A\cap[a,b]}$ is a characteristic function of $A\cap[a,b]$.