Dilute magnetic semiconductors (DMSs), such as (In, Mn)As and (Ga, Mn)As prototypes, are limited to III–V semiconductors with Curie temperatures (
T
c
) far from room temperature, thereby hindering their wide application. Here, one kind of DMS based on perovskite niobates is reported. BaM
x
Nb
(1−
x
)
O
3−
δ
(
M
= Fe, Co) powders are prepared by the composite-hydroxide-mediated method. The addition of
M
elements endows BaM
x
Nb
(1−
x
)
O
3−
δ
with local ferromagnetism. The tetragonal BaCo
x
Nb
(1−
x
)
O
3−
δ
nanocrystals can be obtained by Co doping, which shows strong saturation magnetization (
M
sat
) of 2.22 emu g
−1
, a remnant magnetization (
M
r
) of 0.084 emu g
−1
and a small coercive field (
H
c
) of 167.02 Oe at room temperature. The
ab initio
calculations indicate that Co doping could lead to a 64% local spin polarization at the Fermi level (
E
F
) with net spin DOS of 0.89 electrons eV
−1
, this result shows the possibility of maintaining strong ferromagnetism at room temperature. In addition, the trade-off effect between the defect band absorption and ferromagnetic properties of BaM
x
Nb
(1−
x
)
O
3−
δ
is verified experimentally and theoretically.