Defense strats:
-Identify a good choke point on your border. These points are easier to defend-they allow you to concentrate your defenses, and they will be more likely to survive an attack.
-Once you get the choke point, build fortifications. Additionally, you could rush in a small barracks there and produce militia. It's unlikely they'll be ready soon enough to defend, but if your enemy stalls invading for long enough, an extra militia to defend can't hurt.
-Use terrain. I almost never construct a defensive line along plains (invading tanks are too strong), the exception being very good choke points. Urban areas are decent, but fighting in cities can slow down industry, which is also super important. Hills and forests are very good, as they let your militia units (emergency defense) operate at a +75% boost and provide no benefits to invading tanks. Don't underestimate militia in a hilly province with fortifications! Finally, mountains are golden: tanks are very weak here, increasing your survive ability against tanks (the main invasion weapon of choice). Additionally, enemies will move quite slowly, so if you plant arty well, they can hurt the enemy a bit before they attack your fort. Extra points if you brought along your commandos.
-Spam militia. They can bring you desperate time so you can get the AA and AT into the fort.
-Spam AA and AT once your militia are ready. Most players invade using bombers followed by tanks. Use the AA to ensure that at least some of your AT survive, then use the AT to beat up those tanks! Extra points if you bring along interceptors, arty, tank destroyers or mechanized AA-they are useful in both defense and offense.
-Make sure your industry and research are up to date. I've won a few fights because I had the ability to rush units at lightning pace, and I had them at levels high enough to take on a superior force.
-MAKE A BACKUP PLAN. Sometimes for some freak reason your enemy will rocket, nuclear bomb, or even possible nuclear rocket your defensive line to oblivion. Make sure you have a small reserve to fall back on, and push them up when your main defensive line gets nuked.
Hopefully these strats help-I've used them before to win fights where my enemy had a 3:1 advantage on me.