Splicing electric in attic properly
That qualifies as a junction box. Provide you did everything else correct, (affixed the box to something a rafter, stud, etc., connected the box itself to the ground wire inside, covered any previously knocked-out knock-outs, etc.) then you're fine.