We present a calculation of the kaon B parameter B(K) using lattice QCD. We use improved staggered valence and sea fermions, the latter generated by the MILC Collaboration with N(f)=2+1 light flavors. To control discretization errors, we use four different lattice spacings ranging down to a≈0.045 fm. The chiral and continuum extrapolations are done using SU(2) staggered chiral perturbation theory. Our final result is B(K)=0.727±0.004(stat)±0.038(syst), where the dominant systematic error is from our use of truncated (one-loop) matching factors.